Does a reaction that causes me to move out of range after the spell is cast but before the spell hits cause it to miss?
A couple ways this can be done are
There is no time differential between spellcasting and 'hit' when dealing with Instantaneous casting times.
If a spellcasting has been completed, we look at the duration to understand how long the effect lasts/takes. If the spell is Instantaneous, then
The spell harms, heals, creates, or alters a creature or an object in a way that can't be dispelled, because its magic exists only for an instant.
In addition, Range is no longer a factor once cast:
Once a spell is cast, its effects aren't limited by its range, unless the spell's description says otherwise.
Therefore, a spell that has completed it's casting with an instantaneous effect would deliver that effect before the target had an opportunity to move.
The only way to move out of range would have been to do so before the casting was completed
In any reaction that occurs when the spell is cast, "when the trigger occurs, you can either take your reaction right after the trigger finishes or ignore the trigger. (PHB 193). As such, the spell will still be cast and is governed by this rule from the Range section of Spellcasting:
Once a spell is cast, its effects aren’t limited by its range, unless the spell’s description says otherwise.
So, no matter how far away you move from the reaction, the spell attack will follow you.
According to the rules for readying actions:
...decide what perceivable circumstance will trigger your reaction...
When the trigger occurs, you can either take your reaction right after the trigger finishes or ignore the trigger.
The trigger of "being targeted" with a spell is tricky, as I don't believe it is "perceivable" as is required by the Ready action until the spell is actually cast. Identifying who a spell is going to target before cast could be house ruled but RAW there is nothing to indicate that the actions required to cast a spell indicate the target until the spell occurs.
Since the trigger completes, the spell is cast, at which point you're already targeted, and the spell goes off before you are able to move. In the case of firebolt, the projectile simply moves too fast.