The races in both states could be the first real test of how voters are feeling about President Donald Trump’s agenda.