Thank you for the query.
Most likely this is an abscess
of this area. It is filled with pus what causes pain. Such abscess can be caused by rectal fistula
due to inflammatory intestines disease (like Crohn disease) or by this area infection. It is necessary to go to the ER and have it incised as it can cause whole body infection.
After healing acute inflammation, colonoscopy
should be performed for further diagnostics.
Hope this will help.