TOPEKA, Kan. — On the same night that a special congressional election in Ohio proved too tight to call, one of the most competitive Republican primaries for governor this summer was also deadlocked early Wednesday, as Kansas’s most populous county struggled to tally its votes in the race between Kris W. Kobach and Gov. Jeff Colyer.

Mr. Kobach, a hard-right conservative endorsed by President Trump and known nationally for his grim warnings about voter fraud and illegal immigration, sent his supporters home from a watch party in Topeka just before 1 a.m. as he clung to a lead of a few hundred votes over Mr. Colyer, with 88 percent of precincts reporting.

“Try to get a good night’s sleep,” Mr. Kobach, the Kansas secretary of state, told the dozens of supporters who remained past midnight at a Topeka hotel as returns trickled in. “I don’t know if I’ll be sleeping much.”

The long night came amid delays in counting the votes in Johnson County in suburban Kansas City, home to more than 500,000 people, where new voting machines were being used. Mr. Kobach, who in his current position oversees the state’s elections, said the results might not be finalized for hours.