When the bullet shot straight up reaches its peak, its velocity is zero and deducting frictional losses that heat the atmosphere, all its kinetic energy, mass times velocity squared when the gun was fired, has been converted to potential energy, mass times acceleration of gravity times the maximum height. As the bullet falls and speeds up, the potential energy is converted back into kinetic energy. While frictional losses insure the bullet won’t reach the ground with same velocity it left the ground, it will still hit with enough kinetic energy to do damage.
Correction: kinetic energy = 1/2(mass)(velocity squared)