For me, it's important to get enough food on the bike. Everyone is different, but I've discovered my body needs a fair amount of carbohydrates on my rides. I aim to eat a gel every 45 min to an hour and if the ride is over a couple hours, I'll add in some cheese/PB crackers, a bar or something more substantial every couple hours. My body just needs a lot of sugar to keep going - some people can do very long rides on just water, but I'm not one of those.
Immediately after the ride, I'll drink a high carb sports drink or some juice mixed in with some protein powder. Then a solid meal shortly after. I've found this greatly helps the energy drop post ride if I keep the calories up during and immediately after.
Outside of nutrition, I try to keep the legs elevated and will do some stretching and foam rolling to keep the blood circulating in the legs.