Loosen the castle nut securing the buffer tube to the lower and unscrew it. Capture the spring and detent under the endplate cap as you loosen the nut so it doesn’t get lost. Unscrew the buffer tube fully and pull the BCG back through the hole. Pull the rear pin to lift the upper. Check for the buffer retainer pin and spring. A new buffer tube, spring and buffer may be required to make a good repair.
Previous owner TIG welded the castle nut to the buffer tube in a couple places instead of staking it. Apparently he wanted it *very* secure.