The federal government has sought to bolster election security for years through a popular grant program, but the wildly fluctuating funding levels have made it difficult for state officials to plan their budgets and their projects.