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. (TOS: "Space Seed") In 2365, Captain Picard explained that there were two contemporary philosophies on afterlife. 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")
In the Voyager episode Innocence, the Drayans believe that the energy in a person is set free at the time of death.
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. (Voyager: Innocence)
There were also more concrete examples of the afterlife:
In 2369, after the failure of his artificial heart, Picard supposedly experienced going to the afterlife run by Q as god. At the end of the episode, there is a discussion as to what really happened to Picard, with there being suggestions that he had been hallucinating. (TNG: Tapestry)
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)
Torres experienced being sent to Gre'thor to save her mother from dishonor.
When Neelix died and didn't see anything, he felt so distressed that he thought of taking his own life. (VOY: Mortal Coil).
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).