The Mishnah in Makkot 23a says
"All those liable to receive karet who were flogged in court were exempted from their karet
as it is stated with regard to one liable to receive lashes: “Then your brother shall be dishonored before you” (Deuteronomy 25:3) "
But Devarim 25:2-3 in fact says :
and it shall be, if the guilty one has incurred [the penalty of] lashes, that the judge shall make him lean over and flog him in front of him, commensurate with his crime, in number.
He shall flog him with forty [lashes]; he shall not exceed, lest he give him a much more severe flogging than these [forty lashes], and your brother will be degraded before your eyes.
So it seems like it's only speaking of one who committed a sin liable for lashes (and not for kares). How then can the Mishna use that pasuk to derive that one liable for kares is also exempted by lashes?