Gonna get all medical and boring on this one. The concern with NSAIDS and gut lining is more to do with long term use with non-COX selective inhibitor based compounds (everything that's over the counter); the enzyme it inhibits production of to reduce inflammation also inhibits the replenishing of your gut lining so usually a max of 2 weeks continuous use and then cease (if you're needing pain management for longer than a week you should see a doctor anyway). They are also derivatives of an acetylsalicylic acid compound (this is why you factor in any aspirin you take to the maximum dose, as they're similar bases), which can potentially cause a stomach upset through irritation of the increased acidity; the "take with food" recommendation is to help offset this side effect.
The larger concern with NSAIDS and exercise is the increased renal strain, especially in hotter climates, you increase your risk of acute renal failure (bolded for a reason, note the acute). I did a year placement with the renal team and the dialysis clinics up here, I can assure you it's not something you want, or ANY chronic kidney disease for that matter.