It creates a blast of fire on the weapon when you hit a creature within 5 feet of you. If the creature is outside that range, then the spell fails to create fire, because weird arcane explanation that only a wizard would understand.
(I'm a software developer. "Thing works except in this one odd circumstance because weird arcane explanation that only a specialist would understand" is something I see every day. At least in D&D, I don't have to spend hours walking some clueless fighter through the reasons why the spell won't do what the fighter thinks it should do.)