Minecraft wiki entry for Navigation, associated text: While it does not help in navigating the cave itself, it may be wise to bring a map into a large cave. That way, if you get lost and need to dig your way out, you can navigate back to familiar territory above ground.
A good mining practice is to fully explore and light a cave system, or at least a whole tunnel, before beginning to mine out any resources. It is extremely dangerous to stop and mine in a dark cave system.
As part of exploration, try to "clean up" the area, taking off leftover blocks, filling small pits, and generally smoothing things out. In abandoned mineshafts, clear out most of the fence-and-plank "supports" as the player "claims" an area. This improves both visibility and mobility, cutting down on unpleasant surprises.
Some water flows come from openings in the seafloor. It is possible to mark the entrance with a jack o'lantern, which are generally visible from the sea surface.
If you get completely lost, dig your way out in a staircase fashion. Listen for sounds of lava and flowing water, and do not break blocks directly above you. If you must dig straight up, make sure to place a torch at your feet to break any sand or gravel that could fall on you. It can be useful to check the map to figure out where you would emerge (for example, you would probably want to avoid coming out underwater).