From my understanding, it can help but it would not stop you from pursuing your dream career. If you are an exceptional candidate, residencies will see that through your volunteering, leadership, research, letters of rec, and board exam scores. The lower ranked schools may not have the experiences you need ready at hand, though. For example, I go to an osteopathic medical school that is not highly ranked and they do not have many research experiences readily available but I do research at the MD institution nearby because I want to pursue a competitive specialty. I had to go looking for it and work hard to get it, but it has opened many doors for me in addition to networking opportunities.
Before committing to a school, even if it is lower ranked, you want to see if that school has the opportunities you need to make yourself stand out for residency. For example, if you go to a lower ranked school in the middle of nowhere that does not have any research opportunities at the school or any nearby institutions then it may put you at a disadvantage if you plan on going into a field that only accepts students who have publications.
You can always google that schools residency match list to see where their students end up going and into what specialties, and see if it aligns with your goals.