You have the right idea. It doesn't matter if your GPA is a 3.9 or a 3.4 - what matters is the class rank.
It's different every year at each school. For our school, for c/o 2021, 3.9 would put you top 10-15 and 3.8 would put you around #20-25. But c/o 2023, I think they have ~10 students with 4.0s.
Rank #18 is good, but it depends on the speciality you're applying to. For Prosth and Peds, that's probably a great rank to have. For Surgery, it's decent, but could be better. For Endo, it's probably low. For Ortho, it's definitely on the low side. (This is just my opinion based on what I've heard from classmates).