hi there, your discription fits
that of a nail bed infection which is causing the infected material usually pus or edematous fluid to accumulate at the junction of the nail bed and the skin.As it is a long standing infection the change in the colour of the skin is seen. You should visit a general physician or a surgeon who will make a small incision at the swollen area and drain the pus so that it relieves you of the pain and some antibiotics will need to be prescribed to take care of the infection. This is my opinion but the attending doctor may vary in his opinion once he examines your condition. So take his advise and take care.