Cook the spaghetti according to package instructions until al dente. Drain and set aside.
In a large skillet over medium heat, add the ground beef or turkey. Cook until browned, breaking it apart with a spoon, about 5-7 minutes. Drain excess fat if necessary.
Add the diced onion and minced garlic to the skillet. Sauté until the onion is translucent, about 3-4 minutes.
Stir in the taco seasoning, diced tomatoes (with juice), tomato sauce, and corn. Bring the mixture to a simmer and let it cook for about 5 minutes.
Add the cooked spaghetti to the skillet and toss to combine. Cook for an additional 2-3 minutes until everything is heated through.
Remove from heat and stir in half of the shredded cheddar cheese until melted. Top with the remaining cheese and cover the skillet for a few minutes until the cheese is melted.
Season with salt and pepper to taste. Garnish with fresh cilantro or green onions if desired.