Rebuke can be a messy business within the Church. When is it acceptable to rebuke someone for sin? Is it even your place? A common response is "no, because it's not like you're perfect". And that's true. None of us are perfect. If we all walked around rebuking each other's sins, we'd be doing nothing but fighting over who has the bigger plank in their eye.
The moral of that story is that sometimes, and indeed more often than not, it is a good idea to just shut up. But as is shown in Galatians 2, there are times when staying silent might be the wrong answer. Specifically in verse 11, we see that Paul "withstood him (Peter) to his face", because Peter "was to be blamed".
When you compare Peter and Paul, it's obvious who would be the "inferior" Apostle. Paul, having persecuted the Church, recognised that he was least worthy to be an Apostle, and indeed not worthy to be an Apostle full stop. After all, he had been personally responsible for the deaths of many Christians before his conversion. Peter, by contrast, had been with Jesus for quite some time, faltering only as Jesus was being lead to the cross. Even then, rather than persecuting the Church, he wept bitterly over his denial.
Despite this obvious contrast, Paul did not hesitate to rebuke Peter's hypocrisy. Paul's persecution of the Church was past, and thus most certainly a plank he had removed from his eye. Peter's hypocrisy was not just a speck in his eye, but one that actually affected the Church. Therefore, his sin was worthy of rebuke, and Paul was worthy to rebuke it.
As Christians, it is important that we keep each other accountable. The bigger the sin, the greater an effect it has on the Church as a whole (especially when that sin happens to actually be corrupting the Church). Keep your own conscience clean, then you will be qualified to rebuke those who clearly are not.