PEP or post exposure prophylaxis can be taken after you believe you may have been in a situation that put you at risk for contacting HIV. It must be started within 72 hours of exposure and typically you take a full course for 28 days. Typically this is not the same drug as PreP but a combination of different HIV related medication. There is also whats called PrEP on-demand. This is for those that may be infrequently potentially exposed to HIV and don't want to do PReP but still want some added protection. In this case you take 2 pills up to 24 hours before you are going to have sex, another 24 hours after sex and a fourth 48 hours after sex. Only certain PreP drugs have been tested for this purpose so don't assume every drug can be used interchangeably. Those taking PrEP need to ensure they take it daily and around the same time to ensure adequate level of the drug in your system.
But like someone else mentioned this does nothing for the STI's such as Syphilis, gonorrhea, herpes, chlamydia, etc. which are prevalent in the community. Get tested often if having frequent sex with multiple partners, know the risk and your tolerance for it as well as respect for not transmitting to others.