Sen. Rick Scott, R-Fla., on Wednesday took a shot at Democratic presidential contender Sen. Bernie Sanders, saying people who intend to vote for the Vermont independent in 2020 should just move to Venezuela instead.

The comment came as Sanders, a self-described democratic socialist who is proposing a "Medicare for All" health-care system, attempts to appeal to voters in states that President Donald Trump won in the 2016 presidential election. Sanders scored big ratings and positive reactions from the crowd during a Fox News a town hall Monday night in Pennsylvania, a state that Trump won by some 44,000 votes.

Along with former Vice President Joe Biden, who has yet to declare whether he is running, Sanders is a favorite among Democratic primary voters, according to polls. Sanders also led the crowded Democratic 2020 field in fundraising during the first quarter, when he pulled in $18 million.

Scott, who predicted that Trump would win his reelection bid next year, told CNBC's "Squawk Box" that Sanders has a "legitimate shot" at winning the Democratic presidential nomination. Scott also acknowledged that anything can happen, arguing that a Sanders win would mean a risk to the free market.

"I'm going to the Venezuelan border next week. I'm going to Colombia. I'll be at the Venezuelan border. If you like Bernie Sanders, why don't you go ahead and move to Caracas?" said Scott, who has been an outspoken critic of Venezuela and its socialist policies. Caracas is the capital of Venezuela.

A spokesperson for Sanders did not immediately respond to CNBC's request for comment on Scott's remarks.

Scott's state is home to more than 100,000 Venezuelans and Venezuelan-Americans, the largest concentration in the country.

The Republican Party has used once-wealthy Venezuela, which is now in the midst of an economic and humanitarian crisis, as a cautionary tale about socialism.

Trump has said that "Socialism has so completely ravaged" Venezuela "that even the world's largest reserves of oil are not enough to keep the lights on." He added: "This will never happen to us."

— The Associated Press contributed to this report.