Anything with 2 attacks and the sharpshooter feet can be a decent archer. EK, valor bard, pact of blade warlock (especially hexblade) can all do that and cast spells. Warlock can do a ranged smite with investment in appropriate feats and invocations.

I'm not sure if any of those will win the best minmaxed damage at the table award, but they all can do the job acceptably well, and they all cast spells.