Preheat the oven to 375° F. Butter a baking dish and set side.
In a large skillet over medium heat, add the butter and onions and saute until starting to soften, about 3 to 4 minutes. Sprinkle the flour over the onions and whisk together. Cook the onion/flour mixture until golden brown, about 2 minutes. Stir in the half-and-half and milk and whisk around, allowing mixture to thicken, another 3 to 4 minutes. When sauce has thickened remove from heat, season with salt, pepper, garlic powder, onion powder, paprika and Worcestershire sauce and set aside.
Place half the sliced potatoes and half the diced ham into the greased baking dish. Sprinkle on half the cheeses then pour on half the sauce from the skillet. Repeat with the rest of the ingredients, ending with a layer of cheese and sauce.
Cover the dish with foil and bake for 40 minutes. Remove the foil and bake until the cheese on top is golden and the sauce is bubbling, an additional 20 to 30 minutes.