Preheat the oven to 350 degrees F (175 degrees C).
Layer 1/2 of the potatoes, 1/2 of the ham, and 1/2 of the onions in a 2-quart baking dish; repeat layers.
Cook milk, peas, flour, butter, parsley, salt, black pepper, garlic powder, and onion powder in a saucepan over medium heat, stirring constantly, until thickened, 7 to 10 minutes.
Stir Cheddar cheese into sauce until melted.
Pour sauce over potato and ham mixture; sprinkle with paprika. Cover with aluminum foil.
Bake in the preheated oven until potatoes are tender, about 1 hour. Remove foil and continue baking until lightly browned, about 15 minutes more.