In 2017 a Canadian sniper in Iraq actually shot an ISIS fighter 2.2 miles away using a McMillan TAC-50 sniper rifle chambered in .50 caliber 750 grain Hornady ammunition. The sniper had to calculate the bullet’s trajectory against the wind velocity and keep in mind the speed of the earth’s rotation to do that, with the help of a spotter who determined the best moment to make the shot.
The effective range of a gun is an entirely different matter. That is how far you can shoot with the likelihood of hitting your target. For the M107 the effective range is 5,907 feet, still over a mile. The effective range of a BB gun is 1080 feet, about a fifth of a mile.