Back to IBS, I have it too and have alternated between diarrhea and constipation for decades - had dairy allergy ruled out along with a couple of other things, and this is what keeps my digestive system mostly happy:
Daily probiotic (I take digestive advantage)
peppermint pills as needed, usually when I've been eating out too much or gone heavy on the garlic (Heather's Tummy Tamers are easily found OTC on amazon and drugstores - contain peppermint, ginger, and fennel)
Going easy on garlic and onions - these two never used to bother me, and I love them. But I won't eat a full head of roasted garlic at one sitting anymore without expecting consequences
Those are the big three, but I also find the following helpful:
Daily run and pre-pandemic, yoga (I'll go back to this after the vaccines are widespread hopefully next year)
A little wine (supposed to be good for the stomach because of the prebiotics)
A bit of yogurt and sauerkraut in the diet
Magnesium at night before bed (important to research this one though and not get a version that is a laxative - mg oxide was horrible, for example, but mg citrate was fine) to keep me regular in the morning, help ward off migraines, and relax in the evening for good sleep
Red light therapy is also supposed to help your gut health, along with some other benefits, so I have a body panel and give myself 10 minutes or so first thing in the morning. This one is a bit more "fringe" than others but it seems to get my digestive system going right away if it's being sluggish.