Depending on how the locusts are set, you don't even need unit groups.
You can also set a unit variable (like Locust1) to the first unit and Locust2 to the second.
Then check the distance between those two (this is better than using unit groups).
Also, unit groups don't always work correctly for locusts.