Professor H. Peter Soyer and Katie Lee wrote an article for The Conversation, explaining what happens to your skin when you get sunburnt.
The article goes into detail about the DNA damage and immune cell invasion that occurs as a result of sunburn, explaining why your skin can be sore a few days after burning.