Andy Pettitte and Mariano Rivera built their reputations just as much on playoff success as anything they did during the regular season.

With Pettitte announcing Friday he will join Rivera in retirement following this season, they could both be finished before October even rolls around in their finales.

“Of course it hurts when you get down here toward the end and you realize, ‘Man, if we lose a few more games we could be eliminated,’ ” Pettitte said during a press conference at Yankee Stadium to announce his retirement, first reported by The Post’s Joel Sherman.

“It’s disappointing because you came back [and] I know all the guys in that room expected to win a championship and we felt like going into the season we had the team and the power to do that,” the lefty said. “And so it’s always frustrating whenever it looks like or it feels like that might not be able to happen. But we’ve still got life and we’re gonna play as hard as we can and hopefully we can pull this thing off and get into the postseason.”

In his 18-year career with the Yankees and Astros, Pettitte is 255-152 with a 3.86 ERA. He is also the winningest pitcher in postseason history, having gone 19-11 with a 3.81 ERA, and winning five World Series titles.

No matter the rest of the team’s attitude, it will certainly be a unique situation, as the Yankees honor two of their best pitchers in history while desperately trying to add to it.

Despite the distractions, Joe Girardi is confident his battered team won’t lose sight of the task at hand.

“I know Andy won’t let it become a farewell tour,” the manager said of Pettitte, who will make a final appearance in The Bronx on Sunday against the Giants. “That’s not what he wanted. It won’t get in his way and I think most of the guys had a pretty good inkling that he was gonna retire, so it’s not a shock.”

And if the Yankees do fall short, as it looks like they might?

“I think it means a tremendous amount to them, but I don’t think it will shape his career,” Girardi said. “I don’t think he’ll look back on this year, if we don’t accomplish what we want to accomplish, with regrets.”

The 41-year-old Pettitte came into this season knowing it almost certainly would be his last, regardless of the outcome.

“I really knew almost 100 percent coming into the season,” Pettitte said. “When I decided to come back last season, it was supposed to be for one year. That was the whole plan all along. Then breaking my leg [in 2012] put a little wrinkle in that.”

So, again like Rivera, he opted to give it one more shot.

“There was nothing that went on during the season that was changing my mind,” Pettitte said. “The biggest thing is I’m just done. Mentally and physically, I’m just done and I’ve pitched this season knowing this was gonna be it. It’s been a long, hard year.”

But one in which he has been effective, particularly toward the end of the season after dealing with a back injury.

“You know every year is going to bring different obstacles,” Pettitte said. “I grinded through that like I always have. I felt like I came out the other side pitching the last six weeks or so like I did in the beginning of the season and last year. But it’s just at age 41, it’s a lot tougher.”

Everything has been a lot tougher for the Yankees this year — and would have been even harder without Pettitte.

“He’s been vintage Andy Pettitte,” Girardi said. “At crunch time he’s always there. … It’s just who Andy Pettitte is. When the stakes get higher, he gets better.”

“Part of me coming back was to try to [make] this run again, with this group of guys that we had here and it’s starting to get toward the end of that,” Pettitte said. “And we’ve had a great run and my time here is done.”

He may not get that opportunity again, but hasn’t given up hope.

“We’re not eliminated from this thing yet,” Pettitte said.