Melee vs Spellcaster

It's not spellcasting is easier than melee in Elden Ring, and more the game doesn't seem to be made with the idea that ranged attacks exist.

Sure, some enemies are better equipped to deal with it, being mobile or fighting you in closed spaces, but some enemies are bringing knives to a fireball fight.