I have observed some of my mother's sleep-talking and have even attempted to reply / speak to her during such episodes.
In my experience, I have found sleep-talking to be a part of her dream. In some cases, when she sounded panicky, I have even woken her up partially to rescue her from panic, only to have her drowsily explain that she was dreaming.
However this article by Teodora Stoica in the Scientific American (https://blogs.scientificamerican.com/observations/why-do-we-sleep/) says that sleep-talking happens during NREM sleep and not during REM sleep when dreaming occurs:
Onto stage 3 and 4, characterized by delta waves, the slowest and highest amplitude brain waves, the most unlike waking brain waves. Since delta sleep is the deepest sleep, it is the most difficult stage in which to wake sleepers, and when they are awakened, they are usually sleepy and disoriented. Interestingly, delta sleep is when sleep walking and sleep talking is most likely to occur.
Could the experts here please shed some light on sleep-talking and its relation (or lack thereof) to dreaming?