One of the facts of modern warfare, which has gone into the debate over whether the U.S. military should retain the M4 carbine, and the NATO standard small caliber ammunity it uses, is that a very large share of all shots fired in anger by the military real life are fired at short range, where even pistols have tolerable accuracy. This is also true of most shots fired in anger in civilian life, by criminals, by citizens engaged in self-defense, and by law enforcement. You can count on your fingers the number of criminal snipers in the past decade, and they make national news; SWAT teams fire guns a long range more often, but still not very often.
This is not a technical necessity. Even a standard assault rifle, found the world over in both affluent and non-affluent nations, has remarkable accuracy at a very long range. Even longer range sniper weapons have been around since World War II. Guided artillery ordinance and "smart bombs" also exist and can hit targets with accuracy anywhere in a metropolitan area.
Generally speaking, of course, it is far safer for the person firing a weapon to do so at long range than up close and personal.
Someone looking into their crystal ball forty years ago might have expected war to have become an impersonal, cold blooded, long range affair by now. In air to air combat, this is precisely what has happened in the modern era. But it hasn't happened on the ground.
Two main factors seem to have prevented this from happening. First, combatants know that it is foolish to fight in open territory and seek places where they have cover, like urban areas and ambushes. Second, identifying someone as a friend or foe, and getting into a situation that makes clear that it is necessary to fire, often happens only within close visual or auditory range.
There may also be a third factor. Perhaps soldiers on the ground, by virtue of training and instinct, simply feel wrong about killing in cold blood at long range.
At any rate, the lesson seems to be that sometimes technology doesn't change everything.