If this happens to you constantly, consider asking an audiologist to be tested for auditory processing disorder. It’s a little trickier to diagnose than straight up hearing loss because your hearing abilities are unaffected, so it doesn’t get pinged on those hearing tests they have you do at school.
There’s not really anything you can do about it other than intentionally practice picking out different sounds to try to beef up the part of your brain that’s slacking, but knowledge is power and all that.