President Donald Trump’s decision to cancel a planned trip to the U.K., long intended to be his first official visit to the country, became the latest indication of strains in ties between the U.S. and Britain.

Mr. Trump confirmed in a post on his Twitter account late Thursday night that the visit wouldn’t take place, hours after British newspapers attributed the move to the U.S. leader’s desire to avoid protests.

He...