Depending on the situation and the bear, dogs can be an attractant to bears. This is a fairly regular occurrence.
My bear encounter involved a young juvenile male about 200-250 lbs (black bear) that came barreling out of the woods after my 75lb Golden Retriever...it was pretty clear he was planning on eating "Chuck". Chuck turned around and ran directly back at me with the bear in tow. Bear stopped once it saw myself and my girlfriend at the time and then ran up the hill beside the trail. It then proceeded to sprint down the hill at us and stopped dead less than 10ft from us...where it sat watching us for a nerve racking 10 seconds. It then turned and wandered back up the hill.
I was able to hold my girlfriend (who was trying her hardest to run) in place, and I guessed correctly that the bear was bluffing/test charging. More often than not it will be a bluff charge. If the bear is gnashing teeth and hoping with it's front paws the bear is very nervous/afraid. Just back away slowly with low voices and you'll likely not have an issue.
I have hiked thousands of miles in really remote areas throughout the country, spent lots of time in front country sites, and frequented Grizzly bear areas in MT growing up fishing and elk hunting. This is the only negative/risky bear encounter I have ever had out of all that time.
I like guns but they are NOT the best bear defense by any means at all whatsoever.
Here's a 7 year old female I radio collared the week before my bear encounter.