The answer by bdb484 is correct in all respects, but this answer expands upon it.
The top line conclusion that dead bodies do not have rights and are not legal persons are correct. Dead bodies are closer to being property than to being people.
When a person dies, that dead person's legal rights are transferred by operation of law to an intangible legal entity/structure called their "estate" which is separate from the body and is managed by a person sometimes called an executor or personal representative or administrator, of the dead person's estate. Metaphorically, the dead person's "soul" and personhood and rights and obligations transfer to the estate, which is intangible, and the dead body becomes just another special kind of tangible personal property, which has some properties of toxic waste and some properties of historic landmarks and heirlooms.
Usually, surviving family members have rights with respect to a corpse that are, at least, similar to property rights, and one of the more common kind of litigation regarding dead bodies is over who gets to dispose of the body. The main legislation in Colorado on that point is set forth in the follow section of the Colorado Revised Statutes:
§ 15-19-106. Right of Final Disposition
Subject to section 15-19-105 (2), the right to control disposition of the last remains or ceremonial arrangements of a decedent vests in and devolves upon the following persons, at the time of the decedent's death, in the following order:
a. The decedent if acting through a declaration pursuant to section 15-19-104, subject to the provisions of section 15-19-104 (3)(a)(II);
b. I. Either the appointed personal representative or special administrator of the decedent's estate if such person has been appointed; or
II. The nominee for appointment as personal representative under the decedent's will if a personal representative or special administrator has not been appointed;
c. The surviving spouse of the decedent, if not legally separated from the decedent;
d. A person with the right to direct the disposition of the decedent's last remains in a designated beneficiary agreement made pursuant to article 22 of this title;
e. A majority of the surviving adult children of the decedent;
f. A majority of the surviving parents or legal guardians of the decedent, who shall act in writing;
g. A majority of the surviving adult siblings of the decedent;
h. (Deleted by amendment, L. 2006, p. 900, 5, effective August 7, 2006.)
i. Any person who is willing to assume legal and financial responsibility for the final disposition of the decedent's last remains.
(Deleted by amendment, L. 2006, p. 900 , § 5, effective August 7, 2006.)
Disputes among the persons listed under subsection (1) of this section shall be resolved by the probate court. A third party shall not be liable for refusing to accept the decedent's remains or dispose of the decedent's remains until the party receives a court order or other reasonable confirmation that the dispute has been resolved or settled.
a. If the person with the right to control disposition is unable or unwilling to make such disposition, or if the person's whereabouts cannot be reasonably ascertained, then that person's rights shall terminate and pass to the following, in the following order:
I. The rest of the persons in the class with the same degree of relationship granting the same priority of control over the disposition pursuant to subsection (1) of this section;
II. The next class of persons in the order listed in subsection (1) of this section if no one else with the same degree of relationship granting the same priority of control over the disposition of this section exists or possesses the right of final disposition pursuant to subsection (1) of this section.
b. The person with the right to control disposition shall be presumed to be unable or unwilling to provide for such disposition, or the person's whereabouts shall be presumed unknown, if the person has failed to make or appoint another person to make final ...
There is also law regarding what methods of disposition of a body are legal, what licenses are necessary to dispose of dead bodies, who can be buried in veteran's cemeteries, the process for transporting bodies internationally, how to dispose of bodies that no one claims, and what information has to be filed with whom when a body is buried on private property that is not a cemetery.
Every year or two there is some major case somewhere in the United States where a funeral home operator is prosecuted criminally for accepting bodies for burial or cremation, and then not actually doing so as agreed (often dozens of bodies), while claiming to have done so.
Many jurisdictions require that someone discovering a dead body outside a cemetery report it. Even when the law doesn't create an affirmative duty to do so, it is very common to do so, because moving a dead body can disturb a crime scene and constitute obstruction of justice or something similar.
There is also law governing when a dead body ceases to be a dead body. For example, in Colorado, once a body is cremated, it is no long a dead body for legal purposes and is not subject to the laws governing the disposal of dead bodies.
There is also law regarding what constitutes valid organ donation, what must be done for a body to be used for medical research, and how the remains of body parts used for medical research are to be used when the research is concluded.
There are also laws governing how someone is declared dead, how death certificates are prepared and made available, when autopsies are performed, when bodies that are autopsied or otherwise preserved as evidence are released for disposal, and when bodies can be exhumed.