Hi and welcome,
As your gums around the last molar tooth is painful and sore ,it indicates inflammation of the gingival tissue. this can be caused due to improper cleaning in the area, lodgement of food debris , bacterial plaque and calculus deposits in the gum pockets which lead to redness
, swelling and pain in the gums.
This gum infection
if not treated in time may progress deeper to the periodontal tissues , underlying bone and attachment appartus and eventually may lead to loosing of teeth.
So i suggest you to consult a dentist
and get thorough deep scaling and root planing done for the area followed by a course of antibiotic. this will definitly help relieving the symptoms.
meantime you can use oral antiseptic rinses like chlorhexidine
2 to 3 times daily to prevent infection , maintain good oral hygiene
by brushing and gentle flossing.