NSAIDs are often used to manage pain related to menstrual cramps (dysmenorrhea), endometriosis, and ovarian cysts. They work by inhibiting the production of prostaglandins, which are chemicals that promote inflammation, pain, and fever. By reducing the levels of prostaglandins, NSAIDs help to alleviate pain and reduce inflammation.