If there was injury or accident then its probably paronychia which needs medications and antibiotics to reduce infection which will reduce the swelling and pain.
There are other things which could cause this as well. The history is incomplete hence can't comment in details.
Next Steps
Consult a doctor and get the treatment done.
Answered2022-03-19 07:15:42
Let others know if this answer was helpful