Collisions and layers

I am adding collisions to my game. Currently, when the player and two opponents overlap, it “hits” them both. Is there a way to have it select the object on the closest physics layer/mask so it applies the ‘hit’ to only one?

Edit: found I could set a variable to the z-order with using Max Of Two Numbers, but still need to make a separate event for applying force to each opponent. Also, if I add more than two objects to the group, will the math expression Max Of Two Numbers still work with that group?