Sleeping next to a charging phone is generally considered safe in terms of exposure to direct harm; however, it can have indirect negative effects on sleep quality.
The main concerns include the potential for overheating, especially if the phone is under pillows or blankets, which could pose a fire risk, though such incidents are rare.
More relevant to sleep quality, the presence of a phone within easy reach can disrupt sleep due to the temptation to check the device for notifications, messages, or updates if you wake up during the night.
Additionally, the light from the screen, even if only activated briefly, can interrupt your body's natural sleep cycle by inhibiting melatonin production.
To ensure a better night's sleep, it's recommended to keep your phone at a distance from your bed and preferably not charge it overnight next to you.