Preheat the oven to 375°F (190°C) and grease a baking dish.
In a saucepan, melt the butter over medium heat. Stir in the garlic powder, onion powder, salt, and black pepper.
Whisk in the milk and sour cream until smooth. Add half of the shredded cheddar cheese and stir until melted.
Layer half of the sliced potatoes in the baking dish, then pour half of the cheese sauce over them. Repeat with the remaining potatoes and sauce.
Sprinkle the remaining shredded cheese on top and add panko breadcrumbs if using.
Cover with foil and bake for 40 minutes. Remove the foil and bake for an additional 15 minutes until golden and bubbly.
Let the casserole rest for 5 minutes before serving.