As the damage scales, it will easily outpace your damage with a weapon, so by 11th level there is usually no reason to keep a weapon in your hand.
SourceAnd since, it's a cantrip, it doesn't cost any spell slot!
That applies to cleric since they don't get extra attack or any way of consolidating their weapon attack stat to wisdom but not ranger.
3d6 gives 10.5 expected damage on a hit. A mundane long bow fired twice, if you some how still have 16 dex would be 15. Sacred flame is hitting harder than that against radiant weak enemies. But add in hunters mark and it's a wash, bump dex to a realistic level and the fact magic weapons do exist and it's the bow even against radiant weak. And even in pen and paper with the same wis / dex the bow is going to have better accuracy with far more options for improving it, and in BG3 it's much worse. And that's before getting into Crossbow Expert and Sharp Shooter.
Sacred Flame isn't useless but it's far more situational for ranger.