The Common Application, which we can look to as a guideline, offers up a menu of factors a teacher can “rank” right on their Teacher Recommendation form. The first three items are academic achievement, intellectual curiosity, and quality of writing.
While we always hope a teacher will write a glowing narrative letter and not use a checklist, the primary factors being evaluated are essentially the academic and intellectual potential of the candidate. So... I suggest you make this important choice on the basis of a thoughtful consideration of which teacher you engaged with intellectually. I enjoy exploring this topic with students because they frequently want to choose the teacher they liked most, but by prodding we learn the “why” behind that positivity. Maybe it’s the right reason. Maybe not.
If the best thoughtful choices include a teacher you had in your sophomore year, well then that might be the smart selection. However, don’t avoid the teacher who challenged you if your response was to rise to the challenge. The teacher noticed!