Preheat the oven to 375 degrees F (190 degrees C). Butter a baking dish.
Melt butter in a large skillet over medium heat. Add onion; cook and stir until starting to soften, 3 to 4 minutes. Sprinkle flour over onion and whisk together. Cook until golden brown, about 2 minutes. Stir in half-and-half and milk; whisk until thickened, 3 to 4 minutes more. Remove from heat; season sauce with salt and pepper. Add garlic powder, Worcestershire sauce, onion powder, and paprika.
Place half the sliced potatoes into the baking dish; top with half the chopped ham. Sprinkle half the Cheddar cheese and half the Monterey Jack cheese on top. Pour in half the sauce from the skillet. Repeat layering the remaining potatoes, ham, cheeses, and sauce, ending with a layer of cheese and sauce. Cover dish with aluminum foil.
Bake in the preheated oven for 40 minutes. Remove the foil and bake until the cheese on top is golden and sauce is bubbling, 20 to 30 minutes more.