A vasectomy is very effective in preventing pregnancy, but it will not prevent STIs.
A vasectomy is a surgical procedure on the the vas deferens that closes off the tubes which carry sperm from the testicles. A person with a vasectomy will still produce semen, but the semen will not contain sperm.
Even after a vasectomy, the semen (without sperm) can contain sexually transmitted or blood-borne infections. Also, some sexually transmitted infections that can spread with skin to skin contact. Testing for STIs is still recommended for someone who has had a vasectomy and is sexually active, as are prevention methods like condoms and lube.