When your skin is exposed to ultraviolet light, it sustains DNA damage. Just a few seconds of exposure to sunlight can cause subtle damage. Fortunately, genetically-normal people have an enzyme (an abzyme) in their bodies whose sole purpose is to repair these tiny everyday cellular insults by adding the proper base pairs back into your broken DNA. The unfortunate folks who have xeroderma pigmentosum lack this enzyme, and as a result they must avoid sunlight entirely.
However, if you sustain a severe, blistering sunburn, there is so much damage that the repair enzyme starts to randomly insert base pairs to stitch the DNA strands back together. Thus, it's almost guaranteed that mutations will be introduced. People lose skin cells all the time, so most of these mutated cells will just die and be sloughed off ... but longer-lived cells in the dermis may turn cancerous. This is why just a few blistering burns in your childhood can substantially increase your chances of getting skin cancer as an adult.
Wearing sunscreen can help (usually, see below), but it's never as good as clothing and hats that block sunlight entirely. If you are very fair-skinned you may not even have to get a proper burn before you start feeling the ill effects of excessive sunlight exposure.
There are three types of ultraviolet radiation: UVA, UVB, and UVC. UVB radiation is the kind that causes your skin to visibly burn, but the other types are quite capable of causing DNA damage. Most sunblocks nowadays include chemicals that screen out both UVA and UVB, but the amount (and efficacy) of the UVA-blocking chemicals can vary widely. We rely on the ozone layer to block UVC.
I have very pale skin, and for the past three years I've been mainly nocturnal. When I went to California recently, I knew full well that I was likely to burn, so I mostly wore long sleeves (preferable given the chilly San Francisco climate), wore a hat most days, and religiously slathered on SPF 30 sunblock every morning.
I got only a very mild burn on my nose and cheeks, but by the end of the week I had a case of sun poisoning. Most of my sun-exposed, sunblock-slathered skin looked absolutely normal and had no trace of tan or redness. But it felt hot and tight, and I was having fever and chills. There was little I could think to do but take Advil for the fever and drink lots of liquids (later I found out the Advil would have done me more harm than good, but by that time I was mostly indoors).
I suspect that my illness was caused by my body's reaction to the UVA I'd absorbed over the week that my sunscreen didn't properly block.
It's also possible I was betrayed by my sunscreen. After returning from the trip, I found out that, ironically, sunscreens and lotions that contain bergamot oil, sandalwood oil, benzophenones, PABA, cinnamates, salicylates, anthranilates, PSBA, mexenone, and oxybenzone can cause photosensitivity reactions in some people and make them more likely to burn. Guess what the active ingredient in my sunscreen was? Oxybenzone.
I'm glad I wasn't on any medications, as there are many types of drugs and preparations that can cause increased sensitivity to ultraviolet light:
If you are taking any of the above medications, you should should be doubly careful when you go out in the sun, because research indicates that their photosensitivity effects are triggered by UVA radiation.