If you're planning to ride for long periods of time, it's important to stay hydrated. Proper hydration will improve performance and also stop your legs feeling so tired after your ride.
The simple solution is to drink little and often. The simplest drink is just water. If you have a bottle cage on your bike, you can get a bike drink bottle and put plain old tap water in it. There are some fancy calculators that can tell you how much to drink when riding but drinking little and often should be OK for most rides in most weathers.
Depending on how much water you carry on your bike and where you intend to ride will determine whether or not a bottle or two is sufficient. Also, if you ride a mountain bike off road then bottles are likely to fall off your bike quite easily. One solution is to get a different bottle cage, but many mountain bikers like to use hydration packs. A hydration pack is basically a purpose made small rucksack with a plastic bag inside you fill with water that has a tube coming out of it for you to suck on when you're thirsty. Depending on which one you go for you can get them in sizes up to 3 litres (that's 6 standard drinks bottles).
If you're not averse to carrying a bag on your back then you can also get ones that double as proper rucksacks. Some are only a little bigger so cannot store much but many are available in a decent size like 18 or 25 litres. You can carry your lunch and all bike accessories for a long ride in these. Some come with a hydration bladder as standard and some are compatible so you can choose which one you fit.
On really hot days you might want to consider an electrolyte replacement drink to put in your bottle or bladder. Your body loses salts through sweat and these salts are important for your body to function properly. By drinking an electrolyte solution you can replace lost salts as you ride. Most are added to your water as a tablet or powder. Some have no calories and just replace salts. Others also have sugars to provide energy.