In a medium bowl, combine the softened butter, minced garlic, fresh rosemary, fresh thyme, salt, black pepper, and red pepper flakes (if using). Mix until well combined.
In a large baking dish (9x13 inches), arrange half of the sliced potatoes in an even layer. Spread half of the herb butter mixture over the potatoes.
Layer the chopped spinach over the buttered potatoes, followed by half of the shredded cheese.
Add the remaining potato slices on top, and then spread the rest of the herb butter mixture over these potatoes. Pour the cream evenly over everything, ensuring it's distributed well.
Sprinkle the remaining shredded cheese and the grated Parmesan cheese on top of the dish.
Cover the baking dish with aluminum foil and bake in the preheated oven for 30 minutes. After 30 minutes, remove the foil and bake for an additional 20-25 minutes, or until the potatoes are tender and the top is golden and bubbly.
Remove the dish from the oven and let it cool for 5-10 minutes. Garnish with fresh parsley before serving.
Scoop out servings and enjoy this comforting, savory dish as a delightful main or a hearty side.
Notes
Optional red pepper flakes can be adjusted for desired heat level.