The justices voted 6-3 to allow the federal government to use a citizenship database to help states screen voter records for noncitizens.