Could this be herpes or folliculitis?

8 days ago I had sex with a friend and we did not use protection, he tells me that he is healthy and I am too, the day before I shaved the anal area with an old and used razor, after having strong sex I got these sores near the anus, could it be from friction? or cause of razor burns?

razor bumps are raised and those are flat and have a center more like ulcers.

yes, this looks concerning in regards to herpes. I would recommend you see a primary Doctor as soon as possible for a SWAB test.