This is called stomatitis. The causes are many. A complete check up is needed.
It can be due to angular cheilitis which are caused by infection. Dry out the lesions completely by patting and air drying after washing with a mild soap and use petroleum jelly to lock out moisture. It is vital that the affected areas be clean and completely dry before application of the jelly. You can also apply small amounts of athlete’s foot cream which is available over the counter. If the symptoms persist then please consult a dermatologist as oral antimicrobials may be needed.
It is very difficult to precisely confirm a diagnosis without examination and investigations and the answer is based on the medical information provided. For exact diagnosis, you are requested to consult your doctor. I sincerely hope that helps. Take care and please do keep me posted on how you are doing.