Certain vaccinations can also serve as protective factors against cancer. For example, the HPV vaccine helps prevent human papillomavirus infections, which are linked to cervical and other types of cancer. The hepatitis B vaccine can prevent hepatitis B virus infection, reducing the risk of liver cancer.