What is the difference between the priests and the Levites in the Old Testament?
Initially, God offered to make the entire nation of Israel a nation of priests. "Now therefore, if you will indeed obey My voice and keep My covenant, then you shall be a special treasure to Me above all people; for all the earth is Mine. And you shall be to Me a kingdom of priests and a holy nation.' These are the words which you shall speak to the children of Israel" (Exodus 19:5-6). From this holy nation, the firstborn was to be given to God in His service. "Consecrate to Me all the firstborn, whatever opens the womb among the children of Israel, both of man and beast; it is Mine. ... And it shall be, when the LORD brings you into the land of the Canaanites, as He swore to you and your fathers, and gives it to you, that you shall set apart to the LORD all that open the womb, that is, every firstborn that comes from an animal which you have; the males shall be the LORD'S. But every firstborn of a donkey you shall redeem with a lamb; and if you will not redeem it, then you shall break its neck. And all the firstborn of man among your sons you shall redeem" (Exodus 13:2, 11-13).
From among all these servants of God, God chose Aaron and his descendants to serve as priests for the nation. "Now take Aaron your brother, and his sons with him, from among the children of Israel, that he may minister to Me as priest, Aaron and Aaron's sons: Nadab, Abihu, Eleazar, and Ithamar" (Exodus 28:1). "And you shall gird them with sashes, Aaron and his sons, and put the hats on them. The priesthood shall be theirs for a perpetual statute. So you shall consecrate Aaron and his sons" (Exodus 29:9).
Unfortunately, the Israelites rebelled and made a golden calf to worship while Moses was on Mount Sinai. Only the tribe of Levi stood faithful with Moses. "Now when Moses saw that the people were unrestrained (for Aaron had not restrained them, to their shame among their enemies), then Moses stood in the entrance of the camp, and said, "Whoever is on the LORD'S side-come to me." And all the sons of Levi gathered themselves together to him" (Exodus 32:25-26). God blessed their dedication. "Consecrate yourselves today to the LORD, that He may bestow on you a blessing this day, for every man has opposed his son and his brother" (Exodus 32:29). In reward for their dedication, God replaced the firstborns with the tribe of Levi. "Now behold, I Myself have taken the Levites from among the children of Israel instead of every firstborn who opens the womb among the children of Israel. Therefore the Levites shall be Mine, because all the firstborn are Mine. On the day that I struck all the firstborn in the land of Egypt, I sanctified to Myself all the firstborn in Israel, both man and beast. They shall be Mine: I am the LORD" (Numbers 3:12-13). The Levites then took on the duty of serving God. "At that time the LORD separated the tribe of Levi to bear the ark of the covenant of the LORD, to stand before the LORD to minister to Him and to bless in His name, to this day" (Deuteronomy 10:8). That service included serving the priests. "And I have given the Levites as a gift to Aaron and his sons from among the children of Israel, to do the work for the children of Israel in the tabernacle of meeting, and to make atonement for the children of Israel, that there be no plague among the children of Israel when the children of Israel come near the sanctuary" (Numbers 8:19).
What causes the confusion is that Aaron also descended from Levi. Since all priests descend from Aaron, all priests are Levites. Yet all Levites are not priests, but they do serve the priests. Hence, you find mention of the priests and the Levites together, such as "And he gathered together all the leaders of Israel, with the priests and the Levites" (I Chronicles 23:2). This is also why the Hebrew writer speaks of the Levitical priesthood -- all priests came from a subset of the tribe of Levi. "Therefore, if perfection were through the Levitical priesthood (for under it the people received the law), what further need was there that another priest should rise according to the order of Melchizedek, and not be called according to the order of Aaron?" (Hebrews 7:11).