I enjoy watching some movies and TV shows to see the repeated bad examples distributed to the masses for entertainment purposes. One of the better "bad" techniques involves the good guy getting right up to a bad guy to emphasize just how serious he is. (I will refrain from commenting on the often used "cocking of the gun" to add even more emphasis.)
My point is, you should not get any closer than necessary and you should use cover whenever possible.
Here's a situation to consider: You are alone and have confronted an intruder on your property or have been approached by someone who you have determined to be a potential threat.
It does not take much training to reduce a potential gunfight to a wrestling match, especially if the bad guy really likes fighting and the citizen has an understandable and normal aversion to taking human life or is unable to react in time. If you are within arm's reach of the bad guy, you are vulnerable to being grabbed, stabbed, punched or kicked. You may even have your gun taken away from you.
If the bad guy is compliant, have him prone out with his hands on his head and stay out of reach while you call 911. If the bad guy is non-compliant, try and keep your distance and, if possible, keep an obstacle between the two of you. Better yet, get behind cover and continue to try to verbally control the situation.
I am not advocating retreating. I am stressing that since you do not know the capabilities or the intentions of the bad guy you are trying to control all by yourself, you should minimize the chances of the situation devolving into a "hands-on" contest.