Cancer vaccines are designed to either prevent cancer or treat existing cancer by stimulating the body's immune system to attack cancer cells. These vaccines can be prophylactic, like the HPV vaccine, or therapeutic, targeting specific cancer antigens to enhance the immune response against tumors.