most of the time, this is correct. There are benefits to a melee attack though, since the divine strike damage bonus is multiplied on a crit just like sneak attack is, and sometimes an enemy has deceptively good dex saves compared to their actual armor class. There's also things like magic +x weapons that sacred flame can't really get a similar bonus from anything, poisons if you're into that, and of course having a melee weapon means you can make opportunity attacks without having to take war caster.

But in either case, I find that past level 5 or 6 you have enough power out of your spell slots that you don't have to worry too much about whether you spend a turn melee attacking or using a cantrip.