A funeral (sometimes called services) was a type of ceremonial death ritual associated with the body of a dead humanoid. Funerals often differed across cultures and could play an important role in religious beliefs.
Officers in Starfleet often decided to have a traditional Earth "burial at sea", changed for starships to a burial in space. The deceased was put in a photon torpedo casing, with the flag of the Federation (or, in some cases, the flag of Starfleet Command) draped across it. A senior officer or someone close to the deceased usually said a eulogy, after which another officer blew a Boatswain's whistle as those gathered for the funeral stood at attention. The torpedo casket was then launched or beamed into open space. (Star Trek II: The Wrath of Khan; DS9: "Tears of the Prophets"; VOY: "Alliances", "Coda", "One Small Step", "Ashes to Ashes"; ENT: "Similitude") Civilians were known, according to their wishes, to receive a similar burial, except they were placed inside a different kind of container and beamed into space. (TNG: "The Schizoid Man")
In 2256, at the funeral of Captain Philippa Georgiou, Saru gave a recorded speech about the late Starfleet officer. This speech was later seen by Michael Burnham, who described it as beautiful. (DIS: "Context Is for Kings")
In 2267, after the shuttlecraft Galileo crash landed on Taurus II and Lieutenant Latimer was murdered by an anthropoid living there, Lieutenant Boma helped prepare a burial service for Latimer and hoped Spock, who was in command of the Galileo's stranded crew, would say a few words in order to give Latimer "a decent burial." Due to extreme time constraints, however, Spock declined, much to Boma's frustration. Spock and another of the stranded crew, Doctor Leonard McCoy, debated which of they themselves should preside over the ceremony, Spock believing that McCoy should because he possibly knew "the correct words for such an occasion." After Lieutenant Gaetano was also killed by an anthropoid, Boma insisted that he be given a burial, but since the anthropoids were in the area, Spock was anxious to allow that. He eventually relented, though, granting Gaetano's funeral as long as the anthropoids permitted it. (TOS: "The Galileo Seven")
Data studied various aspects of ceremonial funeral actions while researching the proper way to say goodbye to Ro Laren and Geordi La Forge, while it was believed that they had been killed in a transporter accident. In Data's research, he revealed that "in almost all societies, it is traditional to say a ritual farewell to those you call friends." (TNG: "The Next Phase")
In 2373, Kira Nerys buried Tekeny Ghemor next to her father on Bajor. Gul Dukat had wanted to take him back to Cardassia, but Benjamin Sisko informed him, "Legate Ghemor's funeral arrangements have already been taken care of." (DS9: "Ties of Blood and Water")
In 2376, the Starfleet practice of burial in space directly conflicted with the Kobali practice of salvaging corpses for reanimation as a means of procreation. The body of the late Ensign Lyndsay Ballard of the USS Voyager, who died and was buried in space in 2374, was reanimated to become Jhet'leya. (VOY: "Ashes to Ashes")