I have killed 2 black bears with 44 magnums. Both shot in the point of the shoulder and both quartering towards me. One was with a Hornady 265 grain semi pointed jacketed bullet and one with a 260 grain Keith SWC. The one hit with the SWC bit at the wound and ran in about 3 tight circles and dropped. The one hit with the jacketed bullet did a bit of a "half-back flip", got his feet under him and tried to run but dropped in about 10 feet. The one hit with the Hornady was quite small. Maybe 125 pounds. The one killed with the Keith SWC was about 265 pounds. Neither went far after the shot and both died quickly. Both bullets exited the bears.
Now Grizzlies are a bit of a different story. I have not killed any grizzlies. But a 265 pound black bear sure looks like a teddy bear compared to a 450 to 700 pound grizzly. Where I live I am only about 45 minutes away from a large area that is just full of grizzlies and I hunt elk around them every year. EVERY time I go into that area I see grizzlies. So far I have not had a problem with one, but I have seen them kill animals 2 times (one elk and one cow on a ranch) and I have seen freshly dead animals they have killed about 40 times. They are the real-deal and not something you would EVER want to wound and make mad.
A big handgun with the correct bullet will do, if you can put the bullet where you need to, but where you need to is not a forgiving target. "Fairly close" is not going to do it.
When I hunt up there I carry large rifles. Larger then anyone needs to kill elk or moose, but I am not carrying this kind of power for the game I am hunting, but because I may be the one being hunted. I also carry a 454 Casull loaded to the top power level with 370 grain LBT WFN bullets and I and I wont even go "water a bush" at night" without having the Casull on me. It's not at all a macho thing. It's because when you see what they can do a few times you understand that you may NOT be the boss man out there and that makes you want to have the "largest club you can use well". For me that is usually a 9.3X62, 9.3X74R or 375H&H rifle if I am hunting. If I am guiding or just hiking when I am not hunting, my old M1 Garand loaded with 220 grain Round nose bullets with 3031 powder at about 2350 FPS make me feel a lot better.
In my experience with killing black bears I have come to believe that any black bear up to about 350 pounds can be killed with about any firearm you can use on deer as long as the bullet you use will not break up badly. Even a 357 Magnum handgun with a good bullet is OK for most black bears. I am sure there can be exceptions, but I have hunted them in California, Oregon Idaho Montana and Wyoming and I never saw any problem killing them or breaking them down if you have a tough bullet.
One man who was the local "bear man" in Idaho only used a 30-30 with 170 grain bullets and a Ruger 357 mag with 158 soft nose bullets, and he told me in 50 years of killing them he never had a problem with any black bear. He went to Alaska 2 times in the 60s to hunt Grizzlies. Now that was totally different he said. He used his 30-06 for them and made a good shot on both, but said a hit with his 30-30 in the same place on many many black bears dropped them, but his hit with the 30-06 on the Grizzlies did not, and both ran off and he had to go track them. He said it never scared him to follow up a black. He was "sweating bad" following up the Grizzlies. He got both and both were dead when he found them, but he told me both went far enough to make him very edgy following them by the blood trails.
He was a man who killed more black bears by the time I met him in the late 70 then I have ever seen, before and since. When he told me "to be afraid of a grizzly was not a bad thing", I think such advice is likely to be very good and worth believing.