You could try taking lactase tablets, or stick with dairy products with a naturally lower lactose content if you don't want to fully go lactose free. I drink dairy alternative milks (oat / rice milks etc) but I can tolerate some dairy products that are naturally lower in lactose such as hard cheese.
You can find lactose content charts online like this one:https://foodintolerances.org/lactose-content-of-food/
I also avoid corn products (tortilla chips, popcorn, sweetcorn etc) as I don't digest them well during a flare up.
As I like to eat nuts because they're rich in minerals, while flaring I switch from whole nuts to nut butters, and ground nuts (eg almonds) added to smoothies.
I mostly eat starch that contains more soluble fibre when flaring, like white rice. Potato, sweet potato, and oats are other starches that I can digest during a flare.
Although I'm not gluten intolerant I don't digest wheat well so I avoid that even when not flaring. I've had to be stricter about
not eating any wheat recently since I noticed the effect it was having on the days I was having the odd biscuit or slice of bread. As I'm not celiac I don't have a problem with rye bread though.