Peter is referred to as the rock, because that’s what his name meant in aramaic, when Jesus gave him the name Peter.
He gave him the power to bind and loose on earth, the successors of Peter instituted the sacrament of reconciliation based on
James 5:16 “Confess your offenses to one another”
Scripture allows it. Why not directly confess it to jesus? you can confess your lesser grave sins to Jesus, but for grave sins, you have to do the sacrament of reconciliation which was instituted and IN LINE with “whatever you bind on earth shall be bound in heaven”