It can be caused by an infection such as a perineal/anal abscess or prostate infection. Rarely, a rapidly spreading infection called Fournier gangrene can begin with severe perineal or genital pain, swelling/redness, fever, or feeling unwell, and requires immediate surgery and IV antibiotics. A urology text notes that Fournier gangrene can arise from the perineal skin, scrotum, urethra, or rectum and needs emergency treatment. Campbell-Walsh-Wein Urology
Do
not squeeze, cut, or try to drain the area yourself. You may take paracetamol/acetaminophen if you normally can, but do not delay getting examined. NHS patient guidance also treats genital/perineal pain, swelling or redness with fever as an emergency warning pattern for Fournier gangrene.
NHS warning guidance