Washington (CNN) Sen. Lindsey Graham said Wednesday that President Donald Trump called him after he delivered an emotional farewell to Sen. John McCain on the Senate floor, telling the South Carolina Republican he "did right by his friend."

"He called yesterday after my speech and he couldn't have been nicer. He said, 'That was very sad. I just want to let you know you did right by your friend.' I said, Thank you Mr. President.'" Graham told CNN's Dana Bash in an interview on "Inside Politics" Wednesday, adding that the call from the President was "right out of the blue."

Never one to mince words, Graham admitted when Trump "says something bad about John, it pisses me off."

JUST WATCHED Graham gets emotional remembering McCain Replay More Videos ... MUST WATCH Graham gets emotional remembering McCain 01:58

Asked by Bash how he squares his close friendship with McCain to his new relationship with Trump, Graham said, "If you know anything about me, I want to be relevant. I want to make sure that this President, Donald Trump, who I didn't vote for, ran against, is successful."

He added, "To those who want me to say the only way you can honor John McCain is to fight Donald Trump and try to kick him out of office, I don't agree. I'm going to do what I think is best for the country using what John taught me about the country."

Read More