Preheat your oven to 350°F (175°C). Grease a 2-quart baking dish with cooking spray or butter.
In a large skillet over medium heat, add olive oil. Once hot, add the chopped onion and sauté for about 3 minutes until translucent.
Add the sliced yellow squash and zucchini to the skillet. Season with salt, black pepper, garlic powder, and onion powder. Cook for about 5-7 minutes until the squash is tender, stirring occasionally.
In a large bowl, combine the cooked squash mixture, shredded cheddar cheese, crushed crackers, sour cream, beaten eggs, milk, and cayenne pepper (if using). Mix until well combined.
Pour the mixture into the prepared baking dish and spread it evenly.
Bake in the preheated oven for 30-35 minutes, or until the top is golden brown and the casserole is set.
Allow to cool for 5-10 minutes before serving.