Take into account that the screen in question is simply the tactical view, where as Mick stated, all angles and ranges are simply an abstraction for the likelihood of actually making or missing a shot. When the player actually decides to attack, it switches to a little cinematic cutscene, where the soldier actually raises the weapon from a lowered position, and at that point the alien enemy isn't just standing there with a gun in his face as there is an attempt to dodge.
Keep in mind that assault rifles can still miss at close ranges, and as rooster stated, a range too close can actually make hitting the target more difficult. This is one of the reasons the M-16, which had been the mainstay rifle of the U.S. military since Vietnam was swapped out en masse for the shorter barreled M4 during Desert Storm and other operations in the middle east. The M-16, though more accurate at long ranges, was unwieldy for close combat and room clearing. Shotguns obviously are even better for this, and when used at close distances in XCOM2, the hit chance approaches 100% (if not actually 100%).