The shoulder is all about balance. Balance between muscle groups. Balance between mobility and stability. Balance between anterior and posterior chain.
If you have shoulder pain with exercises you have 2 options: Don’t do that exercise (temporary) and/or modify the exercise to a pain free variation
Just because you have shoulder pain does not mean you can not exercises. You need an asssessment to see what the problem is and modify your exercises accordingly