If dips are a new exercise for you, then your shoulder anatomy might not be dip friendly.
In that case, not going as deep is good advice, or try variations like bench dips or Gironda dips, or even Tiger (tricep lever) push ups.
If you've done them before and the problem is new, then you probably have some tension or trigger points to work out and should look into soft tissue work (massage, foam roll, tennis ball, etc.). You could also have some imbalance. DB shrugs and/or some rear delt/upper back work may help.
See how tight you are with some broomstick dislocations and generic shoulder flexibility drills (check online).
"You must have a very strong reason for doing an exercise. If you don't, scrap it and move on." -Jim Wendler