At an altitude of 300,000 feet the horizon is less than 700 miles away. Infrared is light, light is line of sight so unless an F-35 can achieve low orbit there is no way it can see 700 miles away with infrared sensors.
http://www.ringbell.co.uk/info/hdist.htm
It depends on the altitude of the missile.