Latex condoms work really well in stopping most sexually transmitted infections (STIs) from being passed from an infected partner to another when they are used consistently and correctly every time a person has oral, vaginal or anal sex. Consistently and correctly means that a person makes sure they use a latex condom every time they have oral, vaginal or anal sex and put it on and use it the right way.
Some people are allergic to latex condoms, so there are polyurethane (plastic) condoms that also protect against STIs. Lambskin or animal-skin condoms do not protect against STIs and should not be used.
Some STIs, like herpes and HPV, are transmitted by skin-to-skin contact and can be passed on areas of the genitals NOT covered by a condom. Using a condom still gives the best protection against STIs for a person who is sexually active. Of course, the only way to be sure of not getting an STI is not to have any kind of sex at all.