If a bear. Brown bear or black bear, is in mid determined attack pepper spray likely won't be effective.
However it can be very effective during pre-attack. When the bear is stalking you and checking you out. Or when bluff charging. A blast of pepper spray can be quite effective.
They are better used to deter or prevent an attack rather than stop an attack.
Those big bear spray units put out a cone of fog that can reach up to 30 ft. Bears have very sensitive noses and eyes.
Yes pepper spray does have a limited range. Generally between 3 and 12 ft depending on the unit.
It's for the guy walking towards you berating you and threating you and you become reasonably convinced he's about to hit you.
One of its best use cases is to prevent a fight.
Basically if you would be justified pushing or punching someone you are justified using pepper spray.
One of the reasons it is a great tool is it is highly unlikely to cause injury. Even less likely than punching someone. It is very likely to change someone's behavior almost immediately.
I think the studies you mentioned about the army were about tear gas not pepper spray. There are portable tear gas dispensers they are not as effective as pepper spray.
I think military police on many bases do carry pepper spray.
Part of the reason it was never developed as a weapon for the military is it technically violates treaties against chemical weapons.