As revealed in Jesus, God's Love is God's Law.
God said to the Israelites in Deuteronomy 6: If you love me you will keep my commandments. Jesus said it again in Matthew 5:18-20. In both Deuteronomy 6 and Matthew 5, it is the same. Love lived = Law lived. The end-all-be-all of the Law is "love God and love mankind."
The "least in the Kingdom of God" (Matthew 5:19) is someone who, having knowledge of God's love in Jesus, does not teach God's love but teaches the opposite. This is why legalism is so devastating!
Interestingly, Jesus does not write off "the least in the Kingdom of God" but says they are greater than John The Baptist (Matt 11:11)! Because they live after the cross, they have the knowledge of what Jesus did there and they know of the Holy Spirit being poured out on Pentecost. John was full of doubt because he didn't know the glory of God's love as shown on the cross or the powerful comfort of the Holy Spirit.
Christians who teach law rather than love still have great potential for the Kingdom of God because they know of Christ's death and the Spirit's power and presence. Jesus is making it clear that His mercy is available even for the Pharisee, the legalist and the self-righteous. Why? Because while we were yet sinners, Christ died for each of us!
What amazing grace!
In Matthew 5, Jesus is leading the hearer away from a doing oriented interpretation of righteousness and toward a being interpretation.
He's drawing us toward recognising love as the decision-maker. What would love do? This reaches its apex in the final 6 verses of chapter 5 and then falls into more examples in chapter 6.