Ok so i got this info from Youtube. i'm not sure where this info came from, but does it seem legit?
John Lennon wrote the song in January 1966, closely adapted from
the book The Psychedelic Experience by Timothy Leary, Richard Alpert,
and Ralph Metzner, which they based on, and quoted from, the Tibetan
Book of the Dead, with the understanding that the "ego death"
experienced under the influence of LSD and other psychedelic drugs is
essentially similar to the dying process and requires similar guidance.
Peter Brown claimed that Lennon's only source of inspiration for the
song came from the Tibetan Book of the Dead, which it says Lennon read
whilst tripping on LSD. George Harrison later stated that the idea for
the lyrics came from Leary, Alpert, and Metzner's book. McCartney
confirmed this by stating that he and Lennon once visited the newly
opened Indica bookshop—as Lennon was looking for a copy of The Portable
Nietzsche—and Lennon found a copy of The Psychedelic Experience, which
quoted the lines: "When in doubt, relax, turn off your mind, float
downstream". Lennon bought the book, went home, took LSD, and followed
the instructions exactly as stated in the book.