Some of the benefits of melee range on a caster (properly built to be frontline-capable) are thus:Are there any that benefit from being in melee range?
1) Better coverage of effects that originate from you (Spirit Guardians, Cone of Cold, Thunderwave, Warding Wind, Radiance of the Dawn, etc).
2) Opportunity Attacks. Warcaster has the potential for especially dangerous OAs, up to a point where walking away from you is a "so, you have chosen death" option (for example, you know the Nuclear Wizard combo? That combo works with Warcaster, too. Likewise, so do things like Portent-guaranteed save-or-loses). Though just Warcaster cantrips alone are already a potent deterrent. And enemies standing still to avoid OAs have all kinds of downsides, such as having Disadvantage on ranged attacks, or being stuck standing in your hazard spells.
3) Retribution effects (think Flames of Phlegethos, Armor of Agathys, Fire Shield, Hellish Rebuke, etc). These retribution effects are often good on their own, and often can combo with other things (For another example, Flames of Phlegethos, Fire Shield, and Hellish Rebuke would all trigger Hexblade's Curse per-hit). This can make attacking you in melee into a trap option pretty quick -- after which point you can punish people trying to get away with things like point #2.
3) Range. Quite a few powerful spells and abilities are actually fairly limited in their range -- even things like Counterspell are harder to deal with if the enemy can't just back up to get out of your counter range. Pushing forward can also help with vision control, or seizing key strategic positions on the map.
5) Many of the caster builds that are capable of effective frontlining are also capable of playing at multiple ranges, which means you can "switch-hit" who's standing on the front line, making it harder for enemies to focus anything down (as well as getting extra mileage out of things like AoE heals and temp HP, like Inspiring Leader). It also makes you more adaptable to enemies dropping in from unexpected angles on the party.