Bear bangers and bear spray are designed for slightly different situations.
Bear bangers are intended to use when a bear is still a ways off, but is showing no signs of leaving, or is wandering towards you. The idea is to scare the bear off before he gets close enough that you need to be seriously worried. They generally shoot a few hundred feet. Looking through online forums, there's some suggestions that they are illegal in at least some National Parks, but I didn't find any specifics. But if you are planning on taking them with you, I'd recommend contacting whoever is in charge of the land you are hiking on, and asking if they are legal. Since they work with an explosive charge, there's also a fire risk (relatively low, but if it's a dry environment, the fire risk will still be high). They are louder than things like bells and shouting, but the principle is the same.
Bear spray is for close encounters. By the time the bear is close enough for the spray to be effective, it's obvious that the bear is behaving aggressively. According to http://www.centerforwildlifeinformation.org/BeBearAware/BearSpray/bearspray.html, bear spray should be used when the bear is 25 feet away or more, and should be sprayed for at least 6 seconds (enough to deter even a determined bear). Most of the sprays I read about claimed to shoot 30-35 feet. I'd guess that distance is in ideal conditions- warm, no wind. Bear spray is intended as a last resort, once its clear that noise is not making the bear back off.
In short, bear bangers are meant to work as a deterrent, much like bells or shouting. Bear spray is meant as a defense, for use once you are already in trouble, and the bear is clearly behaving aggressively and is close.
Edit: A note on bells, since their effectiveness is being questioned in the comments. A quick internet search shows that their effectiveness is low, and probably varies geographically and with species: Alaskan bears were observed ignoring it, Sierra bears were slightly less likely to attack a group with bells. Maybe because the Sierra bears are more likely to run into hikers wearing them, and hear them as a warning sign, while in Alaska, there's a lot fewer hikers, so it's just an unfamiliar, unimportant noise. But since the bells are cheap, and no one's reported evidence that they increase bear attacks, I'd still be willing to use one. If anyone finds evidence that they really work do work as a dinner bell though, I'll be very quick to change my mind.