President Donald Trump said Friday that feuding with legislators "sometimes… helps" his agenda on Capitol Hill because "it gets people to do what they're supposed to be doing."

"Sometimes it helps, to be honest with you," Trump told Fox Business host Maria Bartiromo in excerpts of an interview released Friday.

It will air Sunday and Monday on the cable network. Excerpts were also reported by The Hill.

"We'll see what happens in the end," the president said. "But, I think, actually, sometimes it helps.

"Sometimes it gets people to do what they're supposed to be doing," he added. "And, you know, that's the way it is."

In recent months, Trump has battled with top Republican Sens. John McCain of Arizona and Bob Corker of Tennessee.

He has slammed McCain for coming out against the most recent GOP proposals to repeal the basic elements of Obamacare, including the senator's early morning vote that killed a version in July.

McCain, 81, who is battling brain cancer, took a veiled swipe at Trump in a speech Tuesday challenging "half-baked, spurious nationalism" in America's foreign policy.

The president responded in a radio interview that "at some point, I fight back and it won't be pretty."

McCain, chairman of the Senate Armed Services Committee, spent more than five years as a POW in Vietnam.

Regarding Corker, Trump lashed into the retiring senator after he called the White House "an adult day care center."

Corker, 65, who chairs the Senate Foreign Affairs Committee, later told The Washington Post that the president had "castrated" Secretary of State Rex Tillerson on talks with North Korea, creating the possibility of war with Pyongyang or Iran.

This week, President Trump bashed Florida Democratic Rep. Frederica Wilson on Twitter as "crazy" and "wacky."

The four-term representative criticized Trump's remarks Tuesday to a Gold Star widow whose husband was among four Green Berets killed in an Islamic State ambush in Niger.

Wilson charged that Trump told Myeshia Johnson, 24, of Miami Gardens, Florida, that her slain husband, Army Sgt. La David Johnson, 25, "knew what he signed up for... but when it happens it hurts anyway."

Trump also defended his use of social media in these feuds, saying he may have gotten elected with it.

“When somebody says something about me, I am able to go bing, bing, bing and I take care of it,” the president said.

“You have to keep people interested also,” Trump explained. “You know, you have to keep people interested.”

Trump conceded that friends tell him not to use social media. But, he said, it’s a very useful tool to counter “fake news” and respond to critics.

“I can express my views when somebody expresses maybe a false view that they said I gave,” Trump said.

“Tweeting is like a typewriter,” Trump told Bartiromo. “When I put it out, you put it immediately on your show. I mean the other day, I put something out, two seconds later I am watching your show.”

Trump said he felt that he was especially well-suited for Twitter and social media in general.

“You know they are well-crafted,” he said, referring to his tweets. “I was always good student. I am like a person that does well with that kind of thing. And I doubt I would be here if weren’t for social media, to be honest with you. Because there is a fake media out there, I get treated very unfairly by the media.”