electric panel near hot water heater
It is absolutely safe. There is no clearance issue with regard to a water heater, or even a sink, and an electrical panel.  The only issue is with working clearances, and this is an issue regardless of what is around the panel. Based on the letter of the code it is perfectly feasible to have a water heater or sink immediately next to a breaker panel. 

Contrary to popular belief, an electrical panel, or most other electrical equipment, will not explode and blow up the house if contact with water is made. 

I have seen with my own eyes, basements flooded to the rafters, with the electrical panel completely submerged, and on and working. There are many videos online with small appliances like hair dryers, submerged in a sink full of water while still powered and working....completely under water.