The longer you take it and the larger the dose, the greater the risk
Gastric ulcer, kidney issues and even heart attacks can be attributed to NSAIDs like Ibuprofen
Take the lowest dose you need for the least amount of time you need it. That is always my advice to patients. If there’s a specific pain you are taking it for and you can switch over to topical diclofenac, I would recommend that as it is far safer long term.