The audience, which included a who's who of Washington elites, applauded the comment, the Arizona Republic reported.
The almost three-hour service was a remarkable show of defiance against a president McCain openly defied in life.
Defence Secretary Jim Mattis greeted the McCain family on Thursday night when the late senator's casket was flown into Joint Base Andrews, Maryland.
According to the White House pool report, the president arrived at his Trump National Golf Club in Loudoun County, shortly after 11 a.m. Bush passed a piece of candy to Michelle Obama during John McCain's funeral service, And the Internet can't get enough. Their pushback to Trump was more subtle than Meghan McCain's but unmistakable nonetheless. John McCain at the National Cathedral on September 1, 2018 in Washington, DC. But between campaigns and political feuds, McCain and Bush maintained a cordial relationship. "Now, in fact, John was a pretty conservative guy... but he did understand that some principles transcend politics, that some values transcend party". "He called on us to be better than that". We never doubted the other man's sincerity, or the other man's patriotism, or that when all was said and done, we were on the same team.
Obama said they "saw our political battles, even, as a privilege, something noble, an opportunity to serve as stewards of those high ideals at home, and to advance them around the world".
McCain lay in state in the Capitol on Friday.
It was the last public event in Washington, where Mr McCain lived and worked over four decades, and part of Mr McCain's five-day, cross-country funeral procession.
The private ceremony in Annapolis, Maryland, was as carefully planned as the rest of McCain's farewell tour, which began in Arizona after he died August 25 from brain cancer and stretched to Washington.
Obama said it was "no secret" that McCain had a temper that was a "force of nature, a wonder to behold".
Obama, who was McCain's rival in the 2008 presidential race, added, "That's perhaps how we honor him best, by recognizing that there are some things bigger than party, or ambition, or money, or fame, or power, that there are some things that are worth risking everything for".
McCain was one of Trump's sharpest critics, and made clear in one of his final wishes as he struggled with brain cancer that he did not want the president to attend his funeral.
McCain is to be buried on Sunday at his alma mater, the U.S. Naval Academy.