The messages were sent by a first-time volunteer who had signed up for a shift on the campaign’s “texting team” under a fake name and whose real identity was still being investigated, according to a campaign staffer. The campaign believes the messages reached fewer than 1,000 people, the staffer said, adding that they were the only examples of unauthorized messages the campaign had found.

Mr. Cruz and other Republicans have criticized Mr. O’Rourke, who stands within spitting distance of Mr. Cruz in recent statewide polls, as being weak on immigration and supporting socialist policies.

Mr. Cruz’s campaign said it was not aware of the messages and denied any involvement.

Text messages have been hailed as the breakout technology of the 2018 midterms. New peer-to-peer texting apps allow campaigns to send rapid-fire text messages to voters, personalized with details like the voter’s name and nearest polling place, without running afoul of anti-spam regulations that prohibit unsolicited bulk messages. Candidates including Alexandria Ocasio-Cortez, the Democrat from New York, and Andrew Gillum, who won last month’s Florida Democratic primary for governor, have used peer-to-peer texting apps to drive voters to the polls.

Among mass-texters, Mr. O’Rourke has been particularly aggressive. The campaign has used Relay, which was developed by alumni of Bernie Sanders’s 2016 presidential campaign, to contact millions of Texas voters with messages urging them to donate, attend local events and pledge their support on Election Day. Progressive groups have rallied behind Mr. O’Rourke’s “texting team,” which has set a goal of texting all 3.5 million cellphones contained in a statewide voter records database.