Supreme Court Justice Samuel Alito clashed with his liberal colleagues over how to consider race in recent rulings on gun laws and immigration.