The context of Matthew 5:17 makes clear that Jesus was referring to the moral commandments of the law that He came “not to abolish but fulfill” not the ceremonial. John Gill correctly points this out in his commentary on this verse:
“I am not come to destroy, but to fulfil. By ‘the law’ is meant the moral law, as appears from the whole discourse following: this he came not to ‘destroy,’ or loose men’s obligations to, as a rule of walk and conversation, but ‘to fulfil’ it; which he did doctrinally, by setting it forth fully, and giving the true sense and meaning of it; and practically, by yielding perfect obedience to all its commands, whereby he became ‘the end,’ the fulfilling end of it. By ‘the prophets’ are meant the writings of the prophets, in which they illustrated and explained the law of Moses; urged the duties of it; encouraged men thereunto by promises; and directed the people to the Messiah, and to an expectation of the blessings of grace by him: all which explanations, promises, and prophecies, were so far from being made void by Christ, that they receive their full accomplishment in him. The Jews pretend that these words of Christ are contrary to the religion and faith of his followers, who assert, that the law of Moses is abolished; which is easily refuted, by observing the exact agreement between Christ and the Apostle Paul, Romans 3:31 and whenever he, or any other of the apostles, speaks of the abrogation of the law, it is to be understood of the ceremonial law, which in course ceased by being fulfilled; or if of the moral law, not of the matter, but of the ministry of it.”
The fact that Jesus wasn’t referring to the ceremonial commandments is quite clear from the rest of the New Testament scriptures. The writer to the Hebrews explicitly states that there has been “a change of the law” pertaining to the Levitical priesthood and ceremonial commandments:
“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? For the priesthood being changed, of necessity there is also a change of the law.” (Hebrews 7:11-12)
“For on the one hand there is an annulling of the former commandment because of its weakness and unprofitableness, for the law made nothing perfect; on the other hand, there is the bringing in of a better hope, through which we draw near to God.” (Hebrews 7:18-19)
The Apostle Paul also explicitly states that God’s ceremonial commandments regarding circumcision have been repealed under the New Covenant:
“Circumcision is nothing and uncircumcision is nothing, but keeping the commandments of God is what matters [i.e., the moral commandments].” (1 Corinthians 7:19)
“For in Christ Jesus neither circumcision nor uncircumcision has any value. All that matters is faith, expressed through love [i.e., by keeping the moral commandments].” (Galatians 5:6)
“For neither circumcision nor uncircumcision means anything. What counts is a new creation [i.e., being regenerated, justified, and sanctified by faith in Christ].” (Galatians 6:15)
Paul also explicitly states that the law’s dietary restrictions and yearly, monthly, and weekly ceremonial commandments are no longer binding upon God’s people under the New Covenant:
“So let no one judge you in food or in drink, or regarding a festival or a new moon or sabbaths, which are a shadow of things to come, but the substance is of Christ.” (Colossians 2:16-17; cf. Romans 14)
Thus, Jesus was clearly not saying that He had not come to abolish the ceremonial commandments of the law, which were temporary types pointing to His sacrificial death and inauguration of the New Covenant in His blood.
“But now He has obtained a more excellent ministry, inasmuch as He is also Mediator of a better covenant, which was established on better promises.” (Hebrews 8:6)
“In that He says, ‘A new covenant,’ He has made the first obsolete. Now what is becoming obsolete and growing old is ready to vanish away.” (Hebrews 8:13)