With vaccines a majority of the population need to be vaccinated that prevents the disease from spreading.
https://en.wikipedia.org/wiki/Herd_immunity
Here is a graph of Measeles in the United states. Before and after vaccine. https://en.wikipedia.org/wiki/Herd_immunity#/media/File:Meas...
"Vaccine controversies have occurred since almost 80 years before the terms vaccine and vaccination were introduced. Despite overwhelming scientific consensus[1][2] that vaccines are safe and effective,[3] unsubstantiated scares regarding their safety still occur, resulting in outbreaks and deaths from vaccine-preventable diseases." https://en.wikipedia.org/wiki/Vaccine_controversies