Preheat the oven to 350°F (175°C).
Cook the spaghetti or linguine according to package instructions until al dente, then drain and set aside.
In a large skillet over medium heat, melt the butter. Add the sliced mushrooms and cook until browned, about 5 minutes.
Sprinkle the flour over the mushrooms and stir to combine. Cook for 1-2 minutes to form a roux.
Gradually whisk in the chicken broth and heavy cream. Continue stirring until the mixture thickens, about 3-5 minutes.
Add garlic powder, onion powder, black pepper, chopped chicken, and frozen peas to the skillet. Stir to combine.
In the baking dish, combine the cooked pasta with the chicken and sauce mixture. Sprinkle grated Parmesan cheese on top and mix well.
Top with shredded mozzarella cheese and place in the oven.
Bake for 20-25 minutes or until the cheese is bubbly and golden brown.
Remove from the oven and let cool for a few minutes. Garnish with freshly chopped parsley if desired before serving.