To ride long, whether it's during training or a race, you'll need to stay topped off. Aim for around 60 grams of carbohydrates for every hour of cycling, and at least one 500ml bottle of fluid.
A mix of different types of food is usually best (gels, bars, fruit, etc.), but make sure you experiment and discover the food that your body responds well to. What works for someone else might wreck your digestive system.