In general, people with ulcers should use acetaminophen for over-the-counter pain relief. Unless your doctor has said it's OK, you should not use aspirin, ibuprofen, ketoprofen, or naproxen sodium. If acetaminophen doesn't help with your pain, see your doctor.