The nearest I know of to a real ray gun is the Lockheed ADAM anti-missile laser (see also this popular article or Google for much more on the subject). The Lockheed laser is hardly portable, but who knows what a few centuries of power pack design might achieve and it shows that it can be done.
I don't understand your issue with the length of the laser pulse. Suppose you were aiming a torch at someone: as they move you just turn the torch to follow. Make that torch a gigawatt laser and there's your ray gun.
Even in vacuum a laser beam's intensity will get weaker and weaker the more distance it travels. This is due to diffraction, meaning the wave will diverge and "take more space", thus the energy flux per unit area (intensity) will decrease. The total amount of energy is conserved, but the area it is distributed on gets larger and larger. You can see this yourself with a toy laser - the spot size gets bigger when you shine it on a more distant object, so the intensity at each point is weaker.
The angle of divergence of a TEM$00$ mode of a laser, the mode which diverges the slowest, is determined by the minimal spot size and the wavelength:
$$\theta=\frac{\lambda}{\pi w_0}$$
(where $w_0$ is the beam's waist radius)
Meaning if you want a beam to diverge really slowly and get to the moon with the smallest size (so the intensity will be larger), you should increase the beam diameter at the waist (the place where the beam is the smallest).
Best Answer
A photon will travel "at the speed of light" until obstructed. From the speed, and elapsed time, you can calculate how far the light will travel.
Laser light consists of more than one photon "in phase", which has exactly the same property in this respect, as a solitary photon.