The AIM-120 is a formidable missile. Let’s leave it at that.
The “ranged at 40 miles for a fighter sized target” comment isn’t exactly true. There are too many, still classified, details omitted/ignored to make that statement. Radar range depends on a multitude of factors. The APG-66 in the F-16 has been upgraded over the years, and works well, supporting a variety of air to air missiles, but is fundamentally constrained by antenna size in the relatively small F-16 nose.
Effective missile range, radar range, aircraft range, etc. all come down to employment - tactics, if you will. How it gets used and in what scenario. Good pilots, employing the airplane wisely, will be able to defeat a force consisting of superior (on paper) airplanes.
The F-16 will do well against the current Russian AF jets being used in Ukraine. It’s not as good in the pure air to air role as the F-15, which has greater speed, range, weapon capacity, and radar capability, but the F-16 brings multi-role, including CAS, capability to the fight.
As previously discussed, the F-16 is the only choice because it is a common airframe across NATO, which allows NATO training, maintenance and parts support for Ukraine.