hi..thanks for your query.
There are several possibilities in the above case. Most commonly, a Folliculitis
.this is a Bacterial infection occuring in hair folicles.Frequently recurring and very persistent. Occur due to colonization of bacteria like Staphylococcus
. It might be pre existent and now unmasked due to shaving.
You can apply topical Mupirocin cream 2% 2-3 times daily for 7 days on both areas. Avoid any touching of the lesion.
if multiple or recurring ,oral therapy
might be required.If persistent,you should visit a dermatologist
and get treated appropriately.
Hope this helps.take care!