There may be better way, although it may be more complex to create, it may be more efficient.
First, you pick all units into unit group. The range for picking unit into that group should be the maximum range of the laser.
Then you calculate the formula for the laser's line of fire and lastly, you iterate through each unit in the unit group, set its point and check the distance of the point from the line.
IIRC, the calculated distance between point and line is always the shortest distance (if that range is shown as another line, that line will be angled by 90° towards the line of the laser).
There's plenty of stuff on the internet explaining how to get distance between point and line.
The downside is that you have to write those calculations into your trigger (which may be tiring or hard for the first time), but the reward is better efficiency as you don't create many unit groups and it is more precise than unit groups.