There's no problem inherently with Vancian casting, i.e. D&D's system for magic,
There is a big problem: It makes no sense.
I cast fireball!
I cast fireball!
I cast fireb- wait, I can't because, uh, my… book is empty? Or I suddenly forgot how to do it? What. Or I am drained magically - okay, but then why can I still cast other spells, potentially including much stronger ones?
It tries to argue that spellcasting is actually ritualistic and you have to prepare spells. Fair enough, but then why can't I just prepare MORE spells. Rest for a freaking week and have all the spells I need.
Don't sleep for one night and have twice the spells at the cost of some stats, maybe.
Convert spells at higher levels to multiple spells of lower levels to make it more like a "mana bar".
It's just so inflexible and any logical inspection makes the system fall apart at the seams - yes, it is "magic" but that doesn't mean anything goes. It still has to be internally coherent, and it isn't. It never has been.
Other systems are vastly superior in how they implement magic. The best is IMO Shadowrun. You can attempt to cast any spell you know at any strength as often as you want to - but it comes at a price to your health. Spellcasting "hurts" you in a way, because it is mentally draining - the stronger the spell, the more it drains you, including the possibility of death.
There is even the concept of kamikaze mages that train to cast one spell extremely well, so that their spell check succeeds. But they cast it at such a high level that they cannot possibly survive the backlash. It's the mage equivalent of smuggling a nuke in.
More common is of course to cast spells at a level that is manageable for the mage, so they might only take very little damage or none at all.
All that said, 5E is actually the best in this regard, as it has much more at-will or per-encounter spells which scale with your level and that don't force you to rest all the time or become a useless character. Only the stronger stuff is still locked behind those Vancian shenanigans.<
So I'm not actually that worried about magic in this game despite it being D&D.