In a small saucepan, combine the sugar, apple cider vinegar, ketchup, soy sauce, garlic powder, onion powder, salt, paprika, and red pepper flakes (if using). Whisk the ingredients together until they are fully combined.
Heat the saucepan over medium heat and bring the mixture to a boil, stirring occasionally.
Once the mixture comes to a boil, reduce the heat to low and let it simmer for 5-7 minutes, stirring occasionally. This will help the flavors meld together and the sauce to thicken slightly.
In a small bowl, whisk together the cornstarch and water until the cornstarch is fully dissolved.
Add the cornstarch mixture to the saucepan and whisk it in. Let the sauce simmer for an additional 2-3 minutes, or until it has thickened to your desired consistency.
Remove the saucepan from the heat and let the sauce cool for a few minutes before transferring it to a serving dish.
Serve the sweet and sour sauce with your favorite dish, such as chicken nuggets, egg rolls, or stir-fry.