This is more of a question than it is an answer because I honestly don't know if this is a question that can be answered. I have been lifting in some way or another for over 20 years so I do know that every now and then when I really push myself in some sort of weight training and end up sore in a certain part of my body the next day, I kind of like it. It lets me know that I have done enough work for my body to benefit from it and therefore, with the right nutrition, I could be benefitting my muscle mass. I am sure there is such a thing as doing too much though and this has happened to me a couple of times.
src
There are a lot of articles out there entitled something like "how sore is too sore" and "why am I not getting sore anymore." A lot of these that I have read try to come to some sort of universal solution but honestly, it really isn't something that people can accurately answer and ultimately it is going to be up to you to determine this level.
I enjoy getting sore and I know exactly how to make that happen because I track all of my lifts and realize that if I want to achieve soreness and therefore potential muscle growth, I am going to have to do what they call "progressive overload" which is simply always putting a little bit more weight on top of what I did last time. This is the reason why bench presses have what appear to be rather silly weights on them sometimes going below a single KG or just over a pound. You might think something like "who the hell is going to up their bench just 1.5 kg? That's stupid?" Not only is it not stupid but it is the only way to really progress safely in the lifting world.
I see people all the time attempting too much of a next step and then their veins pop out of their face and they get through some sort of half-assed 3-rep and then they are spent. This really isn't a good idea and is also a fantastic way to injure yourself and perhaps to get trapped beneath the bar in the gym.
src
great scene from a funny show called Eastbound and Down
The times that I end up a "good kind" of sore is when I was overloading slightly and then maintaining my rep numbers at the same time. As always I write my lifts down because unless you have some sort of identic memory, I don't think anyone is going to recall every lift they did in the gym the last time they where there. If you aren't doing this you seriously should start.
The "bad kind" of sore that I have ended up with was when I was exploring a new exercise that seemed too easy so I foolishly stepped up the weight quite a lot. The worst one of these that I can remember is when someone online suggested rotating shrugs instead of standard "up-down" shrugs and I guess this motion activated muscles in my neck and shoulders that I don't normally use. Because the main muscles I have there were already strong enough I thought that I could do a rotational movement as well. I didn't realize it while i was doing it but i was severely damaging small muscles in my neck and for the next week or so I had to turn my entire body to even look behind me. It was agony and I will not be doing that again any time soon. I suppose this is another point to make: don't go trying every new trendy lifting movement just because some jacked influencer suggests it. You could be in for a world of hurt.
I think the best advice when attempting to achieve the good kind of sore is to have a plan. If you are tracking your lifts every time you go to the gym it won't be some grand mystery about how much you have to lift to be pushing yourself a little bit, and this is what leads to just the right amount of soreness and therefore, gradual advancement in strength and muscle mass. I always will refer to the exercises in my notebook the day after I do the lifts and make notes about how sore, if at all, I was the following day.
If you end up sore in the gym WHILE you are lifting... it might be a good time to stop lifting. Good soreness is almost never immediate and this is normally a sign that your body is telling you that you better stop that!
Overall I think that just like anything else in fitness it is very important to use baby steps. If you take on too much at one time you might be taking yourself out of commission for many days or even worse, developing chronic pain that you will likely have to endure for many years if not forever.