Commonly, this could just be a thrombosed hemorrhoid that can be treated with soaks and local ointments as it may resolve.
It may need to be lanced. Alternatively, an abscess
(infection) may also present this way. Let's not assume this is benign and will pass (which is likely the case), therefore, if it persists or worsens, seek medical attention fast.