After giving Peter the keys of the kingdom of heaven, Jesus delegated authority to him to carry out his ministry. "Whatever you shall bind on earth," Jesus said to Peter, "shall be bound in heaven, and whatever you shall loose on earth shall be loosed in heaven." (Matthew 16:19)
This was not a blank cheque for Peter to do whatever he wanted. The authority to bind and loose was given in the context of preaching forgiveness of sins through the gospel. This harmonises with the Lord's parting words to the apostles: "If you forgive the sins of any, their sins have been forgiven them; if you retain the sins of any, they have been retained" (John 20:23 NASA). Binding and loosing are equivalent to retaining and forgiving sins. How does this work out in practice?
On the Day of Pentecost, Peter preached the gospel and 3000 people believed that message and received remission of their sins. (Acts 2:38-41) These people were loosed from their sins when they were forgiven. The sins of those who rejected the gospel were retained or bound. The authority to bind and loose was not exclusively Peter's, though he played a prominent role. All the apostles were engaged in opening the way to heaven through preaching the gospel, thereby binding and loosing the sins of the impenitent and the penitent. However, this does not exhaust the meaning of the Lord's words.
The authority to bind and loose was given by Jesus to every congregation of believers.
Jesus made provision for the church to deal with problems that present themselves in the local congregation. He said that when an offender in the church refuses to repent of his wrongdoing, having first been confronted privately, then before witnesses, and finally before the church, the fellowship of the church is no longer to be extended to that person. He is to be rejected. What the church does on earth is what God has already done in heaven. That is what the Lord meant when he gave instruction not just to Peter, but to the whole church:
"Truly I say to you, whatever you shall bind on earth shall be bound in heaven; and whatever you loose on earth shall be loosed in heaven." (Matthew 18:19)