A yellow bandana or even just a ribbon indicates that the dog needs distance from other dogs and / or people.
What are the pros and cons of the yellow ribbon?
Benefits
You no longer have to ask people to keep their dogs at a distance.
You no longer have to tell people not to pet your dog.
Your dog gets space and rest for whatever reason.
As an owner you can feel calmer and you pass this on to your dog.
Cons
The yellow ribbon can (unconsciously) trigger a startled reaction in a dog owner walking past.
Other people need to know the meaning of the yellow ribbon: a question is always welcome then you can offer a word of explanation