Minecraft wiki entry for Exploring_caves, associated text: Food - Cavern exploration may take quite a long time, draining your hunger. Also with mobs spawning, and the fact that you can get lost may further help drain your hunger. Bring filling food such as cooked porkchop and cooked salmon if possible. Cakes can restore a lot of hunger, but will not fill hunger saturation and must be placed before eating.
Optionally, any golden food, for instance, a golden apple, can give you status effects that can aid your survival, like regeneration and absorption.
Optionally, a fishing rod, for fishing. Water can be found in caves, so it may not be much of a bother. However, fishing underground can be slow (no open-sky or rain bonuses), so it may take a while to catch a fish, especially a fish that is edible.
Optionally, a bucket of milk can help remove any status effects inflicted on you, especially cave spider poison and witches.
If the player runs out of food, and gets lost, they can use rotten flesh from zombies as an alternative, or pick off glow berries.
Consuming rotten flesh may result in food poisoning through the form of the hunger effect.