Here's more context Jesus was condemning those who keep their own rules over obeying the commandments of God quoting directly from the Ten Commandments
Mat 15: 3 He answered and said to them,
“Why do you also transgress the commandment of God because of your tradition?
4 For God commanded, saying, ‘Honor your father and your mother’; and, ‘He who curses father or mother, let him be put to death.’ 5 But you say, ‘Whoever says to his father or mother, “Whatever profit you might have received from me
is a gift
to God”— 6 then he need not honor his father [
a]or mother.’
Thus you have made the [b]commandment of God of no effect by your tradition. 7 Hypocrites! Well did Isaiah prophesy about you, saying:
8 ‘These people [
c]draw near to Me with their mouth,
And honor Me with their lips,
But their heart is far from Me.
9 And in vain they worship Me,
Teaching as doctrines the commandments of men.’ ”
Which goes with
And then I will declare to them,
‘I never knew you; depart from Me, you who practice lawlessness!’
1 John 2:3
Now by this we know that we know Him, if we keep His commandments. 4 He who says, “I know Him,” and does not keep His commandments, is a liar, and the truth is not in him.