There might be other factors weakening the beam at a distance, too. The beam glows in every direction, meaning it loses some energy for each millimeter it travels
If the phaser produce a stream of energized particles, which have a relatively brief half life of only a few seconds, this would be one way of explaining what we're seeing.
The beams would quickly just decay away, and not "roam the galaxy" for eons looking for a target.
If shooting at a target with a longer range, a slightly different particle with a longer half life, and perhaps less striking power, could be emitted.