Electrical panels are the primary entrance point for electrical lines into areas of a house. These panels are connected to major appliances, wiring and primary systems in the house that need electricity to operate. Sometimes new or adjacent panels are installed during remodeling work. When that occurs, distance between plumbing and electrical panels is usually not a concern, although some components should be kept separate.
If you are worried about the plumbing near the electrical box, you can rest easy. Plumbing and electrical lines, despite their differences, rarely interfere with each other, and there is no overarching rule for space between the two. Wiring concerns and codes are more focused on the distance between outlets and similar concerns. However, when it comes to the electrical panel, the dedicated panel board space that extends from the floor to 6 feet above the panel board, should remain free of all piping and similar materials.
Sometimes supply conductors are connected to the electrical panel using underground ducts for protection. This duct work leading to electrical panel might be close to gas and water lines that also enter the house, but they should not be too close. Keep the ducts for other lines at least 12 inches away from the supply conductors. If ducts cross instead of moving parallel, at least 6 inches of space needs to exist.
If you have outlets close to your electrical panel and are worried about their proximity to plumbing, the key factor is dampness. Wet or damp locations, especially outdoor locations subject to water damage, need adequate protection. Electrical panels themselves should always be installed indoors and away from the damp. But nearby outlets and mini-panels that act as switchboards need to be sealed in weatherproof enclosures or with weatherproof flaps for protection.
Building codes differ within states and cities. Check with your local building department for more information on panel installation and positioning. Specific rules might apply to your situation that general guidelines do not cover. Do not try to install such a vital part of your electrical system as the primary panel without extensive electrical experience.