Yes, condoms are the only type of contraceptive that can protect against sexually transmitted infections (STIs). This is because they physically reduce contact between the genitals, preventing microbes from being passed on. For this reason, condoms are also known as barrier contraception.
Condoms are 98% effective at protecting against common STIs like chlamydia and gonorrhoea. However, condoms don't fully protect you from such as herpes, genital warts and syphilis which can be spread from skin-to-skin contact.
Condoms help protect against transmission of blood borne viruses such as hepatitis and HIV, and are about 85% effective at preventing HIV infection.