The rules by which Jesus and Paul lived were different in many respects because Jesus was "born under the law" ("beholden to the Torah"):
[Gal 4:4 NASB] (4) But when the fullness of the time came, God sent forth His Son, born of a woman, born under the Law,
But Paul, because of the new covenant ratified upon Jesus' death, was not:
[Gal 3:24-25 KJV] (24) Wherefore the law was our schoolmaster [to bring us] unto Christ, that we might be justified by faith. (25) But after that faith is come, we are no longer under a schoolmaster.
Paul, however, lived in a Roman world, where the only legal religion besides the Roman gods was Judaism, so he was required to maintain his Jewish identity to some degree. To cast off Judaism was to fall afoul of the State. This was at the heart of his controversy with Peter:
Paul did have scruples about with whom a holy person should eat. He apparently had written to the Corinthians about it. However, they misconstrued his instruction as did the messengers from James that influenced Peter. They thought he was saying not to eat with sinners at all. But what Paul was really saying was to not fellowship with anyone who claimed to be a Christian but was not living the life:
[1Co 5:9-13 NLT] (9) When I wrote to you before, I told you not to associate with people who indulge in sexual sin. (10) But I wasn't talking about unbelievers who indulge in sexual sin, or are greedy, or cheat people, or worship idols. You would have to leave this world to avoid people like that. (11) I meant that you are not to associate with anyone who claims to be a believer yet indulges in sexual sin, or is greedy, or worships idols, or is abusive, or is a drunkard, or cheats people. Don't even eat with such people. (12) It isn't my responsibility to judge outsiders, but it certainly is your responsibility to judge those inside the church who are sinning. (13) God will judge those on the outside; but as the Scriptures say, "You must remove the evil person from among you."
Jesus, though mixing freely with ungodly Jews also insisted on discipline for one who claimed to be a disciple but was behaving irresponsibly:
[Mat 18:15-20 NASB] (15) "If your brother sins, go and show him his fault in private; if he listens to you, you have won your brother. (16) "But if he does not listen [to you,] take one or two more with you, so that BY THE MOUTH OF TWO OR THREE WITNESSES EVERY FACT MAY BE CONFIRMED. (17) "If he refuses to listen to them, tell it to the church; and if he refuses to listen even to the church, let him be to you as a Gentile and a tax collector. (18) "Truly I say to you, whatever you bind on earth shall have been bound in heaven; and whatever you loose on earth shall have been loosed in heaven. (19) "Again I say to you, that if two of you agree on earth about anything that they may ask, it shall be done for them by My Father who is in heaven. (20) "For where two or three have gathered together in My name, I am there in their midst."