If your range is 5 feet, your opportunity attack will be executed before the creature leaves the fire tile. According to PHB (p. 195):
The [opportunity] Attack interrupts the movement of the challenging creature, just before leaving the creature,
Opportunity attacks are essentially based on melee strikes, so the range is based on your melee range (ibid):
You can make a casual attack when an enemy creature is out of your reach. To perform the opportunity attack, use your reaction to make a melee attack …
If you have a class feature or similar object that allows spells to be used for OAs, you must apply the general rule as described above, unless the text explicitly overrides the reach reach requirement.