That sleep stage is called 'hypnagogia' and there is an interesting book from 1987 by Andreas Mavromatis where the author investigated it from multiple perspectives.
There is a copy at
https://archive.org/details/hypnagogiaunique0000mavr for everybody's reading pleasure.
See also
https://en.wikipedia.org/wiki/Hypnagogia for reference.