It sounds like depth of field. If (with an APS crop sensor, 30 mm lens, f/4), if you focus at say 6 feet you might have about 2 feet of DOF span, like from 5 feet to 7 feet (coarse approximations). If your subject is distributed at say 6 to 8 feet, this 5-7 DOF zone does not include the far ones. If you focus far, you miss the near ones. Which is your description.
If you focus on the near ones, or on the far ones, you have wasted half of your DOF range in empty space where there is no one. There are DOF calculators which compute these numbers.
Normal procedure would be to focus more near the middle depth of the group (or slightly in front of the middle), to put the zone more centered on your group. So yes, you do chose youyour point of focus too.
And of course, stopping down the f/stop, like from f/4 to f/8 or f/11, could greatly increase the span of DOF, so that the zone size is double or more.
DOF is rather vague, and is NOT a critically precise number. If the calculator say DOF is 5 to 7 feet, then 7.02 feet is no different than 6.98 feet, both are at the limit of acceptability. These 5 to 7 feet numbers are considered the extremes of acceptability, and the actual focused distance will of course always be the sharpest point.