Eating / fueling multi-day rides and races

Not sure where to put this question. Yesterday after the final race of TdB, my stomach was a mess . It started mid race. I didn’t change anything I was eating prior. I did eat two ginger ale gummies and did a shot of maple syrup. After the race my stomach was so upset. I didn’t want to eat but did.today, it is better but not normal. I think it’s due to maybe my HR being so high. :woman_shrugging: how can I remedy this during races? It didn’t happen during the first two but they were shorter. I also had tailwind in my bottle and some with caffeine in it but I just sipped that one.
Suggestions? Been sipping ginger tea all day today.