Shoulder impingement probably
Used to have the same problem, I ignored it until it started to hurt even when I was not doing pull ups... Even when trying to sleep.
Fixed everything with overhead press, which is strange because any shoulder movement was giving me pain except overhead press so I started doing only that, in 2 days I was back to normal and from looking around the internet it seems a really common occurrence.
It might be due to the fact that lats are internal rotators for the shoulder and they are some of the strongest muscle on the entire torso, therefore my back was imbalanced to my shoulders and this was causing me constant pain in everything except overhead pressing because it is a movement where the lats are stretched but not passively, shoulder muscles have to actually work to overcome the lats.
Being a beginner you might have a similar condition, I suggest fixing your weaknesses before they become a constant problem, so if it's a muscular imbalance problem find some exercises that work both antagonist muscles the same or use opposite sets for everything.
For example after one set of pull ups followed up with one set of handstands or overhead press or anything around that.
Or try exercises that directly work antagonistic muscles together like high rows or face pulls which work both your lats and the shoulders at the same time.
If you don't have a barbell or cables face pulls and rows can be done hanging with any type of rope attached to a bar/too of a door or even bands are a good option.
Or in the most desperate situation grab 2 bottles of water in each hand, bend over and start doing external rotations with your arms tucked to the torso. Usually 2kg per arm is heavy enough for some high rep work.
Just remember to not do the mistake of trying to specialize in one exercise, you can prioritize one movement for body culture or for competitions like if you want to be a good runner you might prioritize deadlifts over squats but you've always got to compensate at least a little bit.
It doesn't mean that you have to work every single of the 800+ muscles in the body, but if you do one specific motion over and over again it is usually a good idea to sometimes do the exact opposite movement to avoid injury.
For example even sitting down can be unhealthy if done continuously, but then standing up all the time is bad too, lying down too much can cause health problems. In life you've gotta be always balanced as a rule of thumb.