Preheat your oven to 375°F.
If using fresh spinach, sauté it in a hot pan with a little oil for 2–3 minutes until wilted. Let it cool, then squeeze out all excess moisture using a clean kitchen towel or cheesecloth.
If using frozen spinach, thaw completely and squeeze out as much liquid as possible. This step is very important to avoid a watery dip.
Drain the artichoke hearts well, pat them dry, and roughly chop into bite-sized pieces.
In a large bowl, combine softened cream cheese, mayonnaise, half of the Parmesan, half of the mozzarella, garlic, salt, black pepper, and red pepper flakes if using. Mix until smooth and well combined.
Stir in the chopped artichokes and well-drained spinach. Mix until everything is evenly combined.
Spread the mixture evenly into a cast-iron skillet or oven-safe baking dish.
Sprinkle the remaining Parmesan and mozzarella over the top. Bake for 20–25 minutes, until hot, bubbly, and lightly golden on top.
For a more golden top, broil for 2–3 minutes at the end. Watch closely to prevent burning.
Let the dip cool for 5-10 minutes (it will be extremely hot). Serve warm with your favorite dippers.