It's not that the bullets won't fly a long ways. It's that the range where the gun is accurate is fairly small. Sure you could theoretically shoot it from 20 miles away as long as you're 15 miles above the target and can successfully plot the ballistic arc, windage, etc. But fighter jets aren't flying artillery pieces so their computers don't do that kind of targeting.
The high speed is necessary so the plane doesn’t fall out of the sky. A bullet is going to have a different friction coefficient than a plane so is not as affected by the altitude.
Using the same reasoning, a gun bullet should also be faster with higher altitude, hence have a longer range.