See your doctor.
Yellow stuff could be anything including signs of infection. Since you now can't pull the foreskin all the way down there is likely some swelling.
It may be balanitis. It's somewhat common in uncircumcised men.
You may need an antibiotic, hence, see the doc.
Like Medic Dan mentioned, you could have an infection – this is fairly common in uncircumcised men. You should definitely see a doctor in case antibiotics are needed to clear it up, and you can help prevent further occurrences by cleaning the area carefully, letting the penis head dry before replacing the foreskin, and applying a penis vitamin cream (health professionals recommend Man1 Man Oil) that contains targeted penis nutrients that promote healthy skin.