With foreseeable technology, not really. There are few exceptions. A near lightspeed weapon is really convenient for shooting down small fast moving objects such as missiles, drones, artillery shells, and, in the future, maybe in the bullets. An energy weapon might make it easier to control collateral damage; critical structures could be practically immune and even humans might have very limited risks of lethal damage. Police already use tasers. And energy weapons, sonic and microwave, have been developed for crowd control purposes.
But as a general replacement for guns? The basic issue is that if you are at a relatively close range, relying on humans reflexes for aiming, and need to reliably stop someone, guns are a relatively efficient way to do it. Being mature, simple, cheap, and reliable technology doesn't hurt either.
First point is energy storage. On a gun this is the propellant and the energy is transformed from chemical to kinetic in a very simple and relatively efficient manner. The relatively efficient here means that there are ways to do it more efficiently, but no one bothers since the way it is done is cheap and safe and, in practice, good enough.
For energy weapons this is lots more difficult. There are chemical lasers, but they are really not as convenient as the propellants used in guns. Available batteries have issues of their own as well. And it gets worse. The process of turning the energy into energy weapon is always more complex than with a gun. While this doesn't necessarily make energy weapons less efficient, it does make them more sensitive to wear and tear. And the inverse of collateral damage being easier to control is that practical energy weapons weapons impart their energy to the surface while bullets generally penetrate. This means that if you actually want to stop someone, a gun with a safety bullet will need much less energy to do it.
The end result is that for a given amount of stopping people guns will need much less space to store the energy, can do so reliably for long periods of time (guns are mostly NOT used, but need to work when you need them), and are simple and reliable. Guns would also be much smaller and cheaper than an energy weapon with the same stopping power as the mechanism of operation is simpler. This would be a major factor when arming large numbers of people on a limited budget. Especially when you intend a low rate of actual usage, so that the possible benefits of energy weapons are less important.