Non-steroidal anti-inflammatory drugs (NSAIDs) such as ibuprofen are widely used by athletes, sometimes routinely before training or races. That routine use carries risks that are easy to overlook.
Points from sports medicine:
NSAIDs can irritate the stomach and, especially combined with dehydration in long events, put strain on the kidneys
Some research suggests they may interfere with healing of bone and possibly other tissues, although findings vary
Taking them before exercise “just in case” is generally discouraged
Masking pain can lead people to train on an injury that needs rest or assessment
For ultra-endurance events in particular, many race medical teams advise against NSAIDs during the event because of the combined effect of dehydration, heat and long duration on the kidneys.
If you need pain relief, ask your doctor which options are safer for your situation.