Baby diarrhea TMI pic

Brittany • Mommy to a wonderful 12yr old boy, 9yr old boy 7yr old girl 6yr old girl and 3yr old girl. Due March 11th 2023 with a boy.
My LO is 4mths old and the last 2 days she has had diarrhea. Her poor buts red and sore. I keep ointment on it but she poops in her sleep 😳 she's not running a fever and seems happy. Shes been formula fed for the last month. Her poops look like breast milk poops though. I'm worried about her getting dehydrated but I can't give her water. Could this be from teething? I don't remember my son doing this but that was 5yrs ago.