Do ophthalmologists do both eye exams and contact lens exams? If not, what type of doctor does?

Some do contacts .. Some don't. Most general ophthalmology practices routinely do contact lens fitting, but it is important to call and confirm prior to scheduling. There are optometrists who do contact lens examination.
Yes they do both. You may want to consider seeing an optometrist who can do the same type of exams.