President Donald Trump's use of tariffs as part of a political agenda is a potential drag on markets, according to Goldman Sachs CEO David Solomon.

"The issue is that the president is using tariffs as a broader agenda," Solomon said in a CNBC interview at Recode's Code Conference in Scottsdale, Ariz. "There's no question if the president continues to use tariffs for a broader, political agenda, it can have an impact on market activity."

The Wall Street CEO agreed with the president that there are "very significant" fundamental disagreements between the U.S. and China. But Solomon said he would rather see a "more focused approach" on resolving larger trade issues.

"I agree with the president in pushing this, that we have to rebalance," Solomon said. "The question is, how will it happen, and over what period of time? I think we can make progress on narrow issues around trade."

Still, the Goldman chief executive said "uncertainty" and "dislocation" that comes with tariffs and a trade war is "bad for risk assets." But he also said it's weighing on the economy.

"I am not a big fan of the economic cost of tariffs and I think there is a real economic cost to the U.S. economy and to consumers," Solomon said.

The president warned Mexico on May 30 that he would put a 5% tariff on all Mexican goods if they did not take actions to help curb undocumented immigrants from coming across the border. On Friday, the president called off the Mexico tariffs and said the U.S. and Mexico had agreed on some concessions surrounding immigration.

Tariffs on China are still in place though. In May, the president increased tariff rates on $200 billion worth of Chinese goods and threatened to put levies on another $300 billion — which effectively includes the rest of China's imports in the United States. Trump told CNBC on Monday he would place additional tariffs on Chinese goods if Xi does not attend the G-20 meeting later this month.

WATCH: CNBC's full interview with Goldman Sachs CEO David Solomon