This is pretty vague- could be anything from bacterial infection (e. coli, campylobacer, salmonella...) to inflammatory bowl disease to celiac disease, and many others.
Pertinent things to know:
-How long? Days make infections more likely, weeks to months you're likely looking at a non-infecious issue
-Family history? If you have several relatives with Crohn's disease or ulcerative colitis, that moves inflammatory bowel disease up.
-Losing weight? Celiac and inflamatory bowel disease moving up.
-Any recent antibiotic use? Can set you up for a certain type of colitis.
-Tried going gluten free? (no wheat/barley/oats/rye) If you improve with this, makes celiac a possiblity. Simple blood test available for this.
-Ibuprofen can indeed tear up your stomach, but the blood is usually seen as black stools (digested blood). Red blood in stool is usually coming from the colon, or distal small bowel (or, from a very fast upper bleed- but you'd be in serios trouble by now if that was the case).
Did your doctor ask any of these questions, or do anything other than tell you to eat a bland diet? If not, see a different doctor. They should ask about all of these details, do a thorough abdominal exam (including a rectal), and get bloodwork and a stool sample. If this has been going on for any sort of time, you need a colonoscopy, or at least a flexible sigmoidoscopy (mini-colonoscopy)
-MN MD