Republicans had initially dismissed Democratic challenges in several districts that President Trump carried comfortably in 2024.