Certain vaccines can protect against cancer-causing infections. The HPV vaccine helps prevent cervical, anal, and other cancers caused by the human papillomavirus. The hepatitis B vaccine can reduce the risk of liver cancer. Ensuring vaccinations are up-to-date can be a crucial step in cancer prevention.