Generally I try to avoid that situation altogether if possible by slowing down the advance when you know you're getting close to the surrender distance. 15 ft limit, shoot them at 20, problem avoided.
But I have been to a field where the field size and number of bunkers almost guaranteed that you'd end up accidentally right next to an opponent. Indoors with reduced velocity, but they had a strict 10 ft no shooting rule. If someone was 10 ft or less away you simply could NOT shoot at them. Shoot at their teammates all you want, but DON'T shoot at them. I ended up sharing a bunker with an opponent more than once at that field, it was really trippy. However, you of course could back up to over 10 ft and shoot them if you thought you could pull it off (many did just that), or you could shout "Grenade!". When you did that everyone within 10 ft of you, Including Yourself, was eliminated. One last renter cowering in a back corner bunker? Run up and shout Grenade and end the game. You're really sneaky and can get behind the other team and 4 of them are clustered together? One shout and you've dramatically shifted the game.
000110 200 11202 10 000020
012211 021 22110 22 121101
222001 222 10220 00 022212