In their definitions relating to prohibition and exclusion, the verb ban usually applies to things, and bar usually applies to people. For example, you might ban chocolate cake from your house and say that anyone caught sneaking in chocolate cake will be barred indefinitely. We qualify the distinction with “usually,” however, because it is not a rule, and exceptions abound. Meanwhile, the two words are synonyms when applied to actions (so the act of eating chocolate cake might be either banned or barred), which further blurs the distinction.
Ban is often used to denote official actions of governments and other authorities, while barring is more often unofficial. Also, while ban doubles as a noun, bar does not. There are so many other noun senses of bar that using the word as a synonym of prohibition or exclusion might just cause confusion.
In British English, ban and bar are more closely interchangeable than they are in American English.
For example, these writers use ban in relation to things or actions:
A number of suspensions for drinking, fighting and swearing has led Sydney Academy to ban dances next year. [CBC]
Our children’s school has now banned tree climbing. [Telegraph]
Many young adults dislike abortion and are receptive toward pro-life arguments, but feel uncomfortable with banning abortion entirely. [National Review Online]
And these writers use bar in relation to people or actions:
However, a race in South Africa has led to the AAA barring him from the event. [Guardian]
Legislation to bar those convicted of crimes from serving on school boards and requiring board members to undergo criminal checks has been signed into law. [Star-Ledger]
School rector Father Paul Martin has barred Keith from attending because school policy does not allow “old boys” … [Stuff.co.nz]