Republican candidates Donald Trump (l) and Ted Cruz (r). Getty Images

President Donald Trump on Friday announced that he will travel to Texas in October to campaign for Sen. Ted Cruz, R-Texas, an incumbent in a deep-red state who is facing an unexpectedly tough race for re-election. Trump Tweet The announcement of a presidential campaign trip more than a month in advance reflects the growing sense of panic among Republicans, who fear that a Senate seat once considered among the most solidly Republican in all of American politics could be up for grabs. The reason for the GOP's panic is not so much that Cruz is doing poorly, per se, but that his opponent, Rep. Beto O'Rourke, D-Texas, is doing so well. At 45, O'Rourke is considered a rising star in the national Democratic Party. But in the past month, his campaign has gone into overdrive, bolstered by a viral video of O'Rourke explaining why NFL players should be permitted to kneel in protest during the national anthem.

By mid-August, a large statewide NBC News/Marist poll was showing O'Rourke trailing Cruz by just four points among registered voters. (The poll's margin of error was 3.8 percent for registered voters.) The relatively unknown congressman is now close to tying his race with Cruz, a feat that would have been considered impossible just a few months ago. Cruz won his 2012 Senate race by more than 16 points. CNBC reached out to both the Cruz and O'Rourke campaigns for comment on Trump's upcoming trip. Neither immediately replied. Cruz is also grappling with a "Trump factor" that could even further complicate his prospects for re-election.

The same August Marist poll that showed O'Rourke closing in on Cruz also revealed that the president's approval ratings among adults in the Lone Star State are underwater. Only 43 percent of the nearly 1,000 respondents in the weighted survey said they approved of the job Trump is doing as president. Forty-six percent, meanwhile, said they disapproved, and 11 percent said they were unsure. For Cruz, the idea that his fellow Republican, the president, could actually harm his re-election prospects in Texas would be an especially bitter pill for the senator, who lost the 2016 Republican presidential primary to Trump. The battle for the nomination raged for months between Trump and Cruz, and it often got ugly and personal. Trump repeatedly insulted Cruz's wife, Heidi Cruz, and at one point Trump suggested that Cruz's father, a Cuban immigrant, may have been involved in the assassination of President John F. Kennedy. Cruz, for his part, called Trump a "pathological liar," a "sniveling coward," a "serial philanderer" and "utterly amoral."

WATCH: Cruz says GOP needs to focus on tax cut for working class