Here are two very similar animations that illustrate foreskin retraction:
How the Foreskin Works
Foreskin Animation
...along with associated information.
Very often a boy's foreskin will detach from the Glans sometime before mid to late teens; although, each person is different and much depends upon how curious he is about his body and how much playing he does with it vs. stopping if pulling on it hurts too much.
From what you have written, it seems that your foreskin has detached and that you can roll it back behind the Corona Rim/top of the shaft. As you can see from the animations, the top and sides slip back over the Glans and pleet; however, the bottom that is attached to the Frenulum just stretches.
As long as you do not tug or pull too much against the attachment, you should be just fine and dandy. As mentioned, lubrication helps, whether it is a woman's mucus, saliva, or a commercial product. Until you find your actions comfortable with a woman, make sure her vaginal mucus or other is distributed all around the entrance--no dry spots to possibly catch your foreskin.
As Brandye mentioned, if this continues to bother you, go see your doctor.
How do you handle the foreskin when masturbating?
Depending upon how easily the foreskin retracts, stroking may or may not cause it to move back and forth easily--each person is different.