Your problem is suggestive of a condition called Phemosis. The foreskin opening is tight and prevents smooth retraction onto penis shaft. It often leads to discomfort while intercourse. Because the underneath skin remains less cleaned, it may predispose towards penis skin infections. There may not be any distress when the state is flaccid, however in erect state, esp when you try to pull it backwards, there can be pain. It is treatable. It may require a surgical correction. A detailed assessment of the severity of constriction is required to decide the management.
Next Steps
For more information regarding this you may consult with me directly here on practo.