Dogs can react to strangers and people they don't know for a few different reasons. They might be frustrated because they can't contain their excitement to meet people, or sometimes it can be out of fear because they are worried by these people they don't know. Barking, lunging and growling are a dog's way of communicating that they are trying to put more space between themselves and the stranger. However, some dogs might show more subtle signs instead, like avoiding approaching the person, looking away or putting their ears back. It is always worth seeking advice from a behaviourist to understand the reasons for your dog's behaviour and then to address the root cause.
Try to avoid situations with lots of strangers. When you are out on walks, try to maintain the distance from people that your dog is comfortable with. This might involve safely crossing the road so that strangers don’t try to approach them head-on, walking on quieter routes, or going out at quieter times. It’s useful to understand the smallest distance from a person that your dog is happy with. To do this, imagine your dog has a bubble of personal space around them. Each dog's bubble will be a different size and their bubble will change in size throughout the day depending on how calm or relaxed they are.