Also: you don't have to go to failure to make progress. Do what you can with good form and without pain, and next week, do just a bit more.
Where am I?
In Upgraid you can ask and answer questions and share your experience with others!
If there was an injury then maybe talk to your doctor about the best way to rehab. If it's just causing you pain, maybe try some static stretches rather than lifting for a while, until your shoulder mobility improves. Once you get back to weights, make sure your for is perfect - just use the bar or even a broomstick or something if you need to. Poor form can lead to shoulder pain as well, even if your mobility is good and you have no injuries.