You're asking a great question. Many folks just assume they'll hit their target in a gun fight, and don't think about the backstop.
9mm has plenty of stopping power and has less of a possibility of going through walls (I said less). Many 9mm bullets these days have close to the same velocity of 40mm, so that plays a role in collateral damage too. In general, you also have more control with a 9mm vs. larger caliber because there's less of a recoil. A 9mm paired with the right bullet will be plenty for home defense, and reduce the chances of collateral damage..
Flashlight attachments are better than laser sights. You need to see your target first!
Final bit of advice: get training with your new handgun, and I mean full-on, multi-day course training ... and do it every year. Because the moment you pull out a handgun in a confrontation, you're going to get sued, regardless of whether or not you point it at anything, or shoot it. And if you shoot someone, you'll not only get sued by the "victim", but you'll also be prosecuted by the state. So the more training you have, the better off you'll be in the courts, because you can prove you're not reckless and have proper training. This goes hand-in-hand with frequent, documented, practice. The more training and practice you have, the less chance there is for collateral damage.