TUCSON, Ariz. — Senator John McCain does not say much these days about Donald J. Trump’s attack on his five-plus years as a prisoner of war. Instead, he clenches his teeth and says he will support the Republican Party’s presumptive nominee, who once said derisively about the senator’s time in captivity, “I like people that weren’t captured.”

In the triple-digit swelter here in Arizona, his home state, Mr. McCain, who was the Republicans’ presidential nominee and standard-bearer in 2008, did not openly bemoan this moment from his long political life. He is focusing on what he considers his toughest re-election fight yet, and is betting that the only way to keep his seat is to support Mr. Trump.

“I’m fair game. I’m in the arena,” said Mr. McCain, 79, whose thinning face reflects the decades he has spent traveling around his massive and increasingly diverse state.

Still, the episode sits with traces of bitterness, like old coffee grounds at the bottom of his cup, even if he says otherwise.

For a moment, the July attack on Mr. McCain seemed to be Mr. Trump’s undoing. McCain said he recalled a recent chat with a World War II veteran who had been in a German prison camp. As he delivered the man a missing medal, “he said to me, ‘Why would Trump say something like that about us?’ ” the senator said. “Frankly, I didn’t have an answer for it.”

But Mr. Trump has since called for mass deportations of undocumented immigrants and a wall at the Mexican border, and now the billionaire businessman could be the force that ultimately topples the indomitable Mr. McCain. An estimated 433,000 Hispanics are expected to vote in Arizona this November, an 8 percent increase from 2012.

And Mr. McCain has a credible Democratic challenger, Representative Ann Kirkpatrick, who grew up on an Indian reservation and has strong support from the state’s sizable Native American population. “I just came from a Latino round table, and they are really concerned about McCain’s support for Trump,” she said Tuesday. “It’s very personal here.”

She is working with the state’s Democrats to harness these forces against Mr. McCain and his old guard, which is largely behind Mr. Trump.

Ms. Kirkpatrick said that being anti-Trump “is a strong message,” but she acknowledged that “it’s not the only message.” She recently opened a field office in Tempe, and has many Arizona State University volunteers working the phones. Working out of an old bank, aides sit in the former vault (the door has been removed) to go over Mr. McCain’s statements, year by year, and look for inconsistencies that suggest too long a stay in Congress.

“The race comes down to whether Arizonans take a step back and judge John McCain for being John McCain and his remarkable life of public service,” said Grant Woods, a former state attorney general and the senator’s friend for decades. “And not as being a long-term incumbent, and not as a Republican in a year when the party has a controversial nominee. If they do that, he will win walking away. If they don’t, then it could be tight. Could he lose? Yeah.”

Despite the personal attacks by Mr. Trump on the senator’s integrity and war record, Mr. McCain cannot afford to reject Mr. Trump and alienate his many supporters in Arizona if he hopes to hold his seat, an agonizing trade-off. Mr. McCain is the embodiment of much that voters in both parties, but especially fans of Mr. Trump, have said they would like to jettison this year. He is the ultimate establishment player, having served in Congress for nearly four decades — five terms in the Senate alone.

“Back in the Middle Ages, I was known as the maverick,” Mr. McCain said, smiling wanly.

He is an unapologetic free trader, an interventionist abroad who continues to defend the deeply unpopular war in Iraq, a supporter of private industry and markets, and the original, if inconstant, champion of changes to the immigration system that would help some undocumented immigrants become citizens.

To succeed in what most people believe will be his last political campaign, Mr. McCain must canter around the state assuring Mr. Trump’s detractors that he does not share the businessman’s visions for mass deportation and the dissolution of NATO, while continuing to woo an angry Republican base that overwhelmingly voted for Mr. Trump in the state’s March primary.

“I’ve been feeling it out there for some time,” Mr. McCain said. “In the southern part of the state here, they are not feeling the recovery at all. Then there is this whole issue with these young people and kids carrying around all this debt.”

He added, “The turmoil in this race is more than I’ve ever seen. Younger, newer voters are registering for only one reason, to vote against Trump. So my challenge is to convince that younger newer voter that I am for them.”

His greater challenge may be with Latinos angry at Mr. Trump. According to an analysis of voter and census data by the National Association of Latino Elected and Appointed Officials Educational Fund, Latinos are expected to account for 17 percent of Arizona’s registered electorate this year, with a voter turnout rate at close to 70 percent. Nearly 45 percent of Latino registered voters are Democrats, the report found.

“I’ve always spent a lot of time with the Hispanic community,” Mr. McCain said, “but having said that, they are rising in numbers in the voting population. I’m putting more emphasis there, particularly in light of Trump’s comments.”

Hispanics in the Phoenix area will also be heavily motivated to vote in the sheriff’s election; Joe Arpaio, a Trump supporter who was recently found in contempt of court for willfully violating an order requiring his deputies to stop detaining Latinos, will be on the ballot, trying to keep his seat as Maricopa County sheriff.

A day watching Mr. McCain campaign here this past week reflects his evolving challenges. He sat for the endorsement of a small group of Border Patrol agents, who have also endorsed Mr. Trump, and listened in silence as Art Del Cueto, the president of Tucson Local 2455 of the National Border Patrol Council, explained why Mr. Trump had gotten their approval. “It means so much to me this long relationship we’ve had,” Mr. McCain said about his endorsement, “and the support we’ve tried to provide. ”

Mr. Del Cueto did say that “we did talk to Donald” about his comments concerning Mr. McCain’s war record. “I don’t think it was a comment that has been made again,” he said.

But a bit later, meeting with Hispanic business leaders, Mr. McCain opened with “We’re gonna make America great again and it’s gonna be huge, O.K.?” It was a tiny swipe at Mr. Trump, taken in the manner of a toddler grabbing a cookie when he assumes no one is looking. Then it was on to other topics, like the Federal Aviation Administration reauthorization.

Mr. McCain remains most at home with other veterans, like the one he visited — on Memorial Day, another man waiting on medals. “His wife said he was staying alive to get those medals,” Mr. McCain said, smiling at the memory. “Sometimes it’s a nice job.”