Afterlife was a term referring to any kind of continued existence after one's death. Many different beliefs existed among the different cultures.
Ferengi tradition told that all life profit and loss statements were weighted. Worthy traders were sent to the Divine Treasury, the others to the Vault of Eternal Destitution. (DS9: "Little Green Men")
Some Humans believed that a person would be sent to a different afterlife, either Heaven or Hell, depending on their actions in life. A third related location was Purgatory. (TOS: "Space Seed"; VOY: "Concerning Flight") In 2365, Captain Picard explained that there were two contemporary philosophies on death. One was the belief that death was the transformation into an indestructible and unchanging form. The purpose of the entire universe was to then maintain that form in an Garden of Eden-like place. The other was that death was simply blinking into nothingness. Picard himself believed that the existence of lifeforms was part of a reality beyond what was currently understood as reality and therefore both philosophies were insufficient. (TNG: "Where Silence Has Lease")
Many cultures believed that people would exist in the afterlife in a "pure" physical state, cured of health issues from their previous life. In 2368, when Geordi La Forge and Ro Laren were thrown out of phase by a transporter accident and declared dead by a crew that could not see them, the blind La Forge regarded the continued function of his VISOR as proof that, contrary to what Ro believed, they were still alive. (TNG: "The Next Phase")
Talaxians mythology had a belief in an afterlife known as the Great Forest, in which a great tree stood at the center. It was said that upon death, a Talaxian went to the afterlife and met the souls of their deceased family upon arrival. (VOY: "Mortal Coil")
Vulcans believed in the katra. Tuvok said that Vulcans believed a person's katra, or what some may call a soul, survived after death. Although he believed in it without question as a child, he recently experienced doubts. (VOY: "Innocence")
A species of non-corporeal life forms who fed on the consciousness of corporeal beings used a Matrix to trap the minds of people close to death. The aliens needed the people to enter voluntarily, so they claimed that the Matrix was the afterlife. (VOY: "Coda") One such alien appeared to Janeway and claimed to be her father.
Quark had a dream about going to the Divine Treasury.
In 2375, Julian Bashir and Miles O'Brien were near death while exploring the mind of Luther Sloan. Seeing a light appear in a certain corridor, O'Brien suggested it was The Great Beyond. (DS9: "Extreme Measures")