Preheat your oven to 350°F. While it heats, slice the yellow squash into 1/4-inch thick rounds and finely dice the onion into 1/2-inch pieces. Crush the Ritz crackers into coarse 1/2-inch crumbs—I like to place them in a sealed bag and crush them with a rolling pin for even, consistent-sized pieces. Shred the cheddar cheese and drain the pimentos if they're packed in liquid. Having everything prepped and ready will make the next steps move quickly.
Melt 3 tablespoons of butter in a large skillet over medium-high heat. Add the sliced squash, diced onions, and salt. Cook for about 10 minutes, stirring occasionally, until the squash begins to soften and releases its liquid. This initial cooking step concentrates the squash's flavor and removes excess water that would otherwise make the casserole watery.
Pour the squash and onion mixture into a colander and let it drain for about 5 minutes to remove excess liquid. While draining, combine the sour cream, pimentos, cream of chicken soup, and black pepper in a large bowl. Once drained, add the squash and onion mixture from the colander to the soup mixture and stir until everything is well combined. I find that draining first prevents a soggy casserole while keeping all the wonderful squash flavor intact.
In a small bowl, combine the melted and cooled 1/3 cup butter with the crushed Ritz crackers, stirring until the crumbs are evenly coated. The butter should be cooled to room temperature so it coats the crackers rather than being absorbed immediately. This creates that signature crispy, golden texture when baked.
Spread the squash and soup mixture from Step 3 into a greased 9x13 inch baking dish or similar size. Sprinkle the shredded cheddar cheese evenly over the top, then distribute the buttered cracker topping in an even layer. Bake at 350°F for 30 minutes until the casserole is heated through, the cheese melts into the filling, and the cracker topping is golden brown and crispy.