Sometimes the problem isn't just your form - it might be that you're pushing too hard on the bench press and neglecting shoulder mobility work. I went through that myself and things only really improved when I started doing stretching and mobility drills before training, like barbell rotations and some light movements to warm up the joint.
As for the bench press, the detail that makes a difference for me is keeping your scapula retracted (back against the bench, don't let your shoulders shrug up) and not bringing the bar all the way down to your chest - bring it just a couple fingers above your chest instead, because that excessive range of motion is what causes the discomfort. On barbell curls, avoid bringing your elbow too far forward; keep it more or less aligned with your shoulder, otherwise you get weird stress on the joint.