Let’s look in Genesis 14 NABRE (USCCB) to get some background on this:
When Abram returned from his defeat of Chedorlaomer and the kings who were allied with him, the king of Sodom went out to greet him in the Valley of Shaveh (that is, the King’s Valley).
Melchizedek, king of Salem,* brought out bread and wine. He was a priest of God Most High.
He blessed Abram with these words:c
“Blessed be Abram by God Most High,
the creator of heaven and earth;
And blessed be God Most High,
who delivered your foes into your hand.”
Then Abram gave him a tenth of everything.
Melchizedek is of mysterious origin - King of Salem (Peace) - one who is both King & Priest.
A king of the Davidic line could not be a priest per se in that priests came from the tribe of Levi, & Davidic kings were from the tribe of Judah.