Some interpret John 5:18
"Because of this, the Jews tried all the harder to kill Him. Not only was He breaking the Sabbath, but He was even calling God His own Father, making Himself equal with God."
to be the narrator John making claims in which he agrees with the hostile crowd, instead of simply summarizing what the hostile crowd said. On this line of thinking, the Gospel is claiming that Jesus was making himself equal with God. However, it also seems to entail claiming that Jesus was breaking the Sabbath (as described at John 5:1-17) as the narrator states both things in the same sentence.
Yet, there's a similar situation to John 5:1-30 at Matthew 12:9-14. In Matthew, there is a man with a withered hand (in John, it's a lame man), it's the Sabbath (same in John), and Jesus heals the man (same in John). In Matthew, however, when confronted by the Pharisees in the synagogue,
"In order to accuse Jesus, they asked Him, “Is it lawful to heal on the Sabbath?” 11 He replied, “If one of you has a sheep and it falls into a pit on the Sabbath, will he not take hold of it and lift it out? 12 How much more valuable is a man than a sheep! Therefore it is lawful to do good on the Sabbath.” 13 Then Jesus said to the man, “Stretch out your hand.” So he stretched it out, and it was restored to full use, just like the other. 14 But the Pharisees went out and plotted how they might kill Jesus."
unlike in John 5, where in response Jesus instead gives a long explanation of his relationship with the Father, and doesn't explicitly deny either the accusation by the hostile crowd that He broke the Sabbath, or that He was making himself equal with God.
One answer is that Jesus didn't break God's commandment, but merely the Pharisees' laws. Another is that Jesus indeed did break God's commandment, but that this can still be lawful.
How do those who believe Jesus did break God's commandment at John 5:18 understand his "Therefore it is lawful to do good on the Sabbath" at Matthew 12:12?