The text of the Ten Commandments was dynamic in ancient Israel and appears in three markedly distinct versions in the Bible:[1] at Exodus 20:2–17, Deuteronomy 5:6–21, and the “Ritual Decalogue” of Exodus 34:11–26. From Wikipedia. Note that each one is from a different source based on the JEPD view.

For an in-depth presentation at the Torah.com go to The Origins of the Decalogue – The Decalogue was not originally part of the Sinai theophany but was added later, both in Exodus and Deuteronomy. Its origins lie in wisdom literature. By Dr. Cynthia Edenburg
Also at Torah.com see An Inner-Biblical Elaboration of the Decalogue, Emphasizing the Holiness of Ethics over the Ritual by Prof. Edward L. Greenstein
The Decalogue of Moses W. Shapira’s Leather Strips article by Ross K. Nichols, including his list of The Ten Words below is here at Academia.edu and here in my DropBox.
EB1 I “I am Elohim, your Elohim who liberated you from the land of
EB2 Egypt, from a house of servitude. There shall not be to you
EB3 other Elohim. You shall not make for yourselves a carved thing or any formed
EB4 thing that is in the heavens above, or that is on the earth below,
EB5 or that is in the waters under the earth. You shall not bow
EB6 down to them, and you shall not serve them. I am Elohim
EB7 your Elohim.
EB8 II Sanctify…[the seventh day, and you shall cease on it because in]
EC1 Six days I made the heavens and the earth,
EC2 and all that is in them, and I ceased on the seventh day,
EC3 therefore, you shall also cease, you and your animal and all that is
EC4 yours. I am Elohim your Elohim.
EC5 III Honor your father and your mother, [thereby lengthening your days.] I am Elohim your Elohim.
EC6 IV You shall not kill the soul of your brother. I am Elohim your Elohim.
EC7 V You shall not commit adultery with the woman of your neighbor. I am Elohim your Elohim.
EC8 VI You shall not steal the property of your brother. I am Elohim your Elohim.
ED1 VII You shall not swear in My Name to deceive because I will avenge
ED2 the iniquity of fathers upon children unto a third and unto a fourth for lifting
ED3 My Name to deceive. I am Elohim your Elohim.
ED4 VIII You shall not respond against your brother with a testimony of deceit. I am Elohim your
ED5 Elohim.
ED6 IX You shall not desire [your neighbor’s] woman, his servant, his maidservant, or anything that
ED7 is his. I am Elohim your Elohim.
ED8 X You shall not hate your brother in your heart. I am Elohim your Elohim.”
ED9 Elohim spoke these ten words.
Deuteronomy 5 NRSV – The D Source.
And he said:
6 I am the Lord your God, who brought you out of the land of Egypt, out of the house of slavery; 7 you shall have no other gods before me.
8 You shall not make for yourself an idol, whether in the form of anything that is in heaven above, or that is on the earth beneath, or that is in the water under the earth. 9 You shall not bow down to them or worship them; for I the Lord your God am a jealous God, punishing children for the iniquity of parents, to the third and fourth generation of those who reject me, 10 but showing steadfast love to the thousandth generation of those who love me and keep my commandments.
11 You shall not make wrongful use of the name of the Lord your God, for the Lord will not acquit anyone who misuses his name.
12 Observe the sabbath day and keep it holy, as the Lord your God commanded you. 13 Six days you shall labor and do all your work. 14 But the seventh day is a sabbath to the Lord your God; you shall not do any work—you, or your son or your daughter, or your male or female slave, or your ox or your donkey, or any of your livestock, or the resident alien in your towns, so that your male and female slave may rest as well as you. 15 Remember that you were a slave in the land of Egypt, and the Lord your God brought you out from there with a mighty hand and an outstretched arm; therefore the Lord your God commanded you to keep the sabbath day.
16 Honor your father and your mother, as the Lord your God commanded you, so that your days may be long and that it may go well with you in the land that the Lord your God is giving you.
17 You shall not murder.
18 Neither shall you commit adultery.
19 Neither shall you steal.
20 Neither shall you bear false witness against your neighbor.
21 Neither shall you covet your neighbor’s wife. Neither shall you desire your neighbor’s house, or field, or male or female slave, or ox, or donkey, or anything that belongs to your neighbor.
Deuteronomy 5 ASV – The D Source.
6 I am Jehovah thy God, who brought thee out of the land of Egypt, out of the house of bondage.
7 Thou shalt have no other gods before me.
8 Thou shalt not make unto thee a graven image, nor any likeness of anything that is in heaven above, or that is in the earth beneath, or that is in the water under the earth: 9 thou shalt not bow down thyself unto them, nor serve them; for I, Jehovah, thy God, am a jealous God, visiting the iniquity of the fathers upon the children, and upon the third and upon the fourth generation of them that hate me; 10 and showing lovingkindness unto thousands of them that love me and keep my commandments.
11 Thou shalt not take the name of Jehovah thy God in vain: for Jehovah will not hold him guiltless that taketh his name in vain.
12 Observe the sabbath day, to keep it holy, as Jehovah thy God commanded thee. 13 Six days shalt thou labor, and do all thy work; 14 but the seventh day is a sabbath unto Jehovah thy God: in it thou shalt not do any work, thou, nor thy son, nor thy daughter, nor thy man-servant, nor thy maid-servant, nor thine ox, nor thine ass, nor any of thy cattle, nor thy stranger that is within thy gates; that thy man-servant and thy maid-servant may rest as well as thou. 15 And thou shalt remember that thou wast a servant in the land of Egypt, and Jehovah thy God brought thee out thence by a mighty hand and by an outstretched arm: therefore Jehovah thy God commanded thee to keep the sabbath day.
16 Honor thy father and thy mother, as Jehovah thy God commanded thee; that thy days may be long, and that it may go well with thee, in the land which Jehovah thy God giveth thee.
17 Thou shalt not kill.
18 Neither shalt thou commit adultery.
19 Neither shalt thou steal.
20 Neither shalt thou bear false witness against thy neighbor.
21 Neither shalt thou covet thy neighbor’s wife; neither shalt thou desire thy neighbor’s house, his field, or his man-servant, or his maid-servant, his ox, or his ass, or anything that is thy neighbor’s.
Exodus 20 – NRSV – The E Source
1 Then God spoke all these words:
2 I am the Lord your God, who brought you out of the land of Egypt, out of the house of slavery; 3 you shall have no other gods before me.
4 You shall not make for yourself an idol, whether in the form of anything that is in heaven above, or that is on the earth beneath, or that is in the water under the earth. 5 You shall not bow down to them or worship them; for I the Lord your God am a jealous God, punishing children for the iniquity of parents, to the third and the fourth generation of those who reject me, 6 but showing steadfast love to the thousandth generation of those who love me and keep my commandments.
7 You shall not make wrongful use of the name of the Lord your God, for the Lord will not acquit anyone who misuses his name.
8 Remember the sabbath day, and keep it holy. 9Six days you shall labor and do all your work. 10But the seventh day is a sabbath to the Lord your God; you shall not do any work—you, your son or your daughter, your male or female slave, your livestock, or the alien resident in your towns. 11For in six days the Lord made heaven and earth, the sea, and all that is in them, but rested the seventh day; therefore the Lord blessed the sabbath day and consecrated it.
12 Honor your father and your mother, so that your days may be long in the land that the Lord your God is giving you.
13 You shall not murder.
14 You shall not commit adultery.
15 You shall not steal.
16 You shall not bear false witness against your neighbor.
17 You shall not covet your neighbor’s house; you shall not covet your neighbor’s wife, or male or female slave, or ox, or donkey, or anything that belongs to your neighbor.
Exodus 20 – ASV – The E Source
1 And God spake all these words, saying,
2 I am Jehovah thy God, who brought thee out of the land of Egypt, out of the house of bondage.
3 Thou shalt have no other gods before me.
4 Thou shalt not make unto thee a graven image, nor any likeness of any thing that is in heaven above, or that is in the earth beneath, or that is in the water under the earth: 5 thou shalt not bow down thyself unto them, nor serve them; for I Jehovah thy God am a jealous God, visiting the iniquity of the fathers upon the children, upon the third and upon the fourth generation of them that hate me, 6 and showing lovingkindness unto thousands of them that love me and keep my commandments.
7 Thou shalt not take the name of Jehovah thy God in vain; for Jehovah will not hold him guiltless that taketh his name in vain.
8 Remember the sabbath day, to keep it holy. 9 Six days shalt thou labor, and do all thy work; 10 but the seventh day is a sabbath unto Jehovah thy God: in it thou shalt not do any work, thou, nor thy son, nor thy daughter, thy man-servant, nor thy maid-servant, nor thy cattle, nor thy stranger that is within thy gates: 11 for in six days Jehovah made heaven and earth, the sea, and all that in them is, and rested the seventh day: wherefore Jehovah blessed the sabbath day, and hallowed it.
12 Honor thy father and thy mother, that thy days may be long in the land which Jehovah thy God giveth thee.
13 Thou shalt not kill.
14 Thou shalt not commit adultery.
15 Thou shalt not steal.
16 Thou shalt not bear false witness against thy neighbor.
17 Thou shalt not covet thy neighbor’s house, thou shalt not covet thy neighbor’s wife, nor his man-servant, nor his maid-servant, nor his ox, nor his ass, nor anything that is thy neighbor’s.
Exodus 34 NRSV – The J Source
11 Observe what I command you today. See, I will drive out before you the Amorites, the Canaanites, the Hittites, the Perizzites, the Hivites, and the Jebusites. 12 Take care not to make a covenant with the inhabitants of the land to which you are going, or it will become a snare among you. 13 You shall tear down their altars, break their pillars, and cut down their sacred poles 14 (for you shall worship no other god, because the Lord, whose name is Jealous, is a jealous God).
15 You shall not make a covenant with the inhabitants of the land, for when they prostitute themselves to their gods and sacrifice to their gods, someone among them will invite you, and you will eat of the sacrifice. 16 And you will take wives from among their daughters for your sons, and their daughters who prostitute themselves to their gods will make your sons also prostitute themselves to their gods.
17 You shall not make cast idols.
18 You shall keep the festival of unleavened bread. Seven days you shall eat unleavened bread, as I commanded you, at the time appointed in the month of Abib; for in the month of Abib you came out from Egypt.
19 All that first opens the womb is mine, all your male livestock, the firstborn of cow and sheep. 20 The firstborn of a donkey you shall redeem with a lamb, or if you will not redeem it you shall break its neck. All the firstborn of your sons you shall redeem.
No one shall appear before me empty-handed.
21 Six days you shall work, but on the seventh day you shall rest; even in plowing time and in harvest time you shall rest. 22 You shall observe the festival of weeks, the first fruits of wheat harvest, and the festival of ingathering at the turn of the year. 23 Three times in the year all your males shall appear before the Lord God, the God of Israel. 24 For I will cast out nations before you, and enlarge your borders; no one shall covet your land when you go up to appear before the Lord your God three times in the year.
25 You shall not offer the blood of my sacrifice with leaven, and the sacrifice of the festival of the passover shall not be left until the morning.
26 The best of the first fruits of your ground you shall bring to the house of the Lord your God.
You shall not boil a kid in its mother’s milk.
27 The Lord said to Moses: Write these words; in accordance with these words I have made a covenant with you and with Israel. 28He was there with the Lord forty days and forty nights; he neither ate bread nor drank water. And he wrote on the tablets the words of the covenant, the ten commandments.
Exodus 34 – ASV – The J Source
1 Observe thou that which I command thee this day: behold, I drive out before thee the Amorite, and the Canaanite, and the Hittite, and the Perizzite, and the Hivite, and the Jebusite. 12 Take heed to thyself, lest thou make a covenant with the inhabitants of the land whither thou goest, lest it be for a snare in the midst of thee: 13 but ye shall break down their altars, and dash in pieces their pillars, and ye shall cut down their Asherim; 14 (for thou shalt worship no other god: for Jehovah, whose name is Jealous, is a jealous God); 15 lest thou make a covenant with the inhabitants of the land, and they play the harlot after their gods, and sacrifice unto their gods, and one call thee and thou eat of his sacrifice; 16 and thou take of their daughters unto thy sons, and their daughters play the harlot after their gods, and make thy sons play the harlot after their gods. 17 Thou shalt make thee no molten gods.
18 The feast of unleavened bread shalt thou keep. Seven days thou shalt eat unleavened bread, as I commanded thee, at the time appointed in the month Abib; for in the month Abib thou camest out from Egypt. 19 All that openeth the womb is mine; and all thy cattle that is male, the firstlings of cow and sheep. 20 And the firstling of an ass thou shalt redeem with a lamb: and if thou wilt not redeem it, then thou shalt break its neck. All the first-born of thy sons thou shalt redeem. And none shall appear before me empty.
21 Six days thou shalt work, but on the seventh day thou shalt rest: in plowing time and in harvest thou shalt rest. 22 And thou shalt observe the feast of weeks, even of the first-fruits of wheat harvest, and the feast of ingathering at the year’s end. 23 Three times in the year shall all thy males appear before the Lord Jehovah, the God of Israel. 24 For I will cast out nations before thee, and enlarge thy borders: neither shall any man desire thy land, when thou goest up to appear before Jehovah thy God three times in the year.
25 Thou shalt not offer the blood of my sacrifice with leavened bread; neither shall the sacrifice of the feast of the passover be left unto the morning. 26 The first of the first-fruits of thy ground thou shalt bring unto the house of Jehovah thy God. Thou shalt not boil a kid in its mother’s milk.
Related are the Holiness Code and others in Leviticus. Below are extracts from Wikipedia here.
The Holiness code is used in biblical criticism to refer to Leviticus chapters 17–26, and sometimes passages in other books of the Pentateuch, especially Numbers and Exodus. It is so called due to its highly repeated use of the word holy (Hebrew: קדוש qəḏōš or kadash[1]).[2] Kadash is usually translated as “holy”, but originally meant “set apart”, with “special”, “clean/pure”, “whole” and “perfect” as associated meanings.
Leviticus 19, which ends in a colophon, has a similarity with the Ten Commandments (Ethical Decalogue), although presenting a more detailed and expanded version, leading critical scholars to conclude it represents a much later version of that decalogue. Notably, it contains the commandment popularly referred to as love thy neighbor as thyself (the Great Commandment).
By this reckoning, there are thus at least five earlier law collections which were redacted together, with an additional hortatory conclusion, to form the Holiness Code. Two of which contain a list of sexual prohibitions, and one of which was a development of the Ritual Decalogue.