The short answer - YES. It's a major no-no.
Electronics hold a deeply rooted place in our lives, even while we are sleeping. Researchers report that a majority of children, and a surprisingly high number of adults, admit to sleeping with a charging device in bed or under their pillow. Sleeping with a device is a bad choice from sleep hygiene and mental health perspectives, but from a safety standpoint, sleeping with a charging device is downright dangerous. Bottom line - keep phone charges out of bed.
53% of children/teens charge their phone either on their bed or under their pillow. This can be extremely dangerous. The heat generated cannot dissipate and the charger will become hotter and hotter. The likely result is that the pillow/bed will catch fire. This places the sleeper, as well as everyone else in the home, in great danger.
The National Fire Protection Association (NFPA) advises, "Smartphones should be charged in locations that allow for adequate ventilation so they do not overheat. Charging them under a pillow, on a bed or couch doesn't allow for the necessary airflow."