That is part of Jesus’ bifold ministry. The context is love. He was talking in front of Pharisees who were trying to catch him up, just like the time he said to cast the first stone. Jesus had a ministry to make the law even more impossible for man since the Pharisees would do the same thing you are implying, obeying certain parts of the law to make it possible. And then also to show his grace to come in the new covenant.

Matt 5 he clearly states until all fulfilled. The new covenant doesn’t start at Matt 1. It starts at the cross when Jesus shed his blood (Heb. 9:16)
Christ cried out on the cross “it is finished”