I've struggled with this too. Mage Slayer of course is supposed to be this sort of thing, except that it is an entire feat defeated by the possibility of a 5' move.
There are a few options. Reach weapons are a possible solution, but aren't the best, since, IIRC, you don't threaten the "inside" square. So smart casters will just stay inside your reach.
Proving that 5' step is stupid, the other solution is to ready an action to move with the caster and attack when they cast. That actually works pretty well.
I know, anything you have to ready an action to deal with is busted. But, well, 5' step has always been the most-gamed, least cinematic portion of D&D tactics. Steven Segall, in...."FIVE FOOT STEP!" Watch him inch cautiously across the battlefield. Watch him hedge away from evil in order to cast from just outside of reach!
Feh, you get my point.