I had canker sores almost nonstop as a child. This was by far the most painful mouth issue I dealt with.
My mom (a TCM doctor) would often give me this medicine, and the sores would calm down almost instantly. But, they still popped up occasionally. My theory is that it was related to unexpressed stress.
In TCM, the stomach channel runs upward through your face and into the gums and mouth. When too much 'heat' builds up in the stomach, it can flare upwards and manifest as mouth ulcers or oral inflammation.
You can fall into this pattern from consuming too much alcohol and spicy or greasy food. But pent up frustration and chronic stress that goes unexpressed and unmanaged are also said to contribute to this imbalance.
The medicinal formula of Xi Gua Shuang/Watermelon Frost relies strongly on the "Three Yellows" or San Huang (Huang Qin, Huang Lian, Huang Bai). These are bitter and cold herbs, rich in berberine and isoquinoline alkaloids (analgesic) and can help to clear systemic heat.
Berberine has also been studied by itself to reduce inflammation and pain in oral ulcers. The watermelon component is very cooling and soothing for the ulcers themselves, and works so well in a pinch when dealing with canker sores. I can highly recommend it.
But for the long term, do consider the emotional, dietary, or lifestyle patterns that might underly this. Addressing those can be even more potent, and I haven't had canker sores in so long since doing so!