As long as you don't swallow the hydrogen peroxide it's safe to gargle using hydrogen peroxide.
Gargling with hydrogen peroxide can help with canker sores and soothe sore throats as well as whiten teeth and disinfect your mouth to keep your mouth healthy.
Too whiten teeth with hydrogen peroxide you'll need to gargle with hydrogen peroxide everyday consistently for a few months to see whiter teeth.
I've gargled with hydrogen peroxide for years to get rid of canker sores in my mouth and never had a problem.
You can also use apple cider vinegar for gargling to get rid of canker sores and disinfect your mouth as well which is a safer gargle than hydrogen peroxide and it's safe to swallow if you happen to swallow it.