The Gemorrah in Pesachim that you mention in the title says that a man may not walk between two women nor a woman between two men and to do so is dangerous. While the Gemorrah does not give a reason to avoid this practice, some Poskim derive from the context that it is related to witchcraft and sheidim which are not common today and explain why most people are not careful. However, many great Rabbonim were very careful of this Gemorrah and did not dismiss it. Furthermore, there is an additional Gemorrah that says that such practice could cause a person to forget his learning and lose him memory, and this may be caused by other factors that would still apply today.
Therefore, a woman should avoid walking between two men regardless of her Nidah status, whether they are standing or seated and even entering and exiting a synagogue. However, one should not be compulsive regarding avoiding these situations. Also, if two women are walking together they may walk between two men. Furthermore, if one holds an object at his side it is like a second person. This is one reason why many Gedolim always carry a cane or an umbrella.