But children will always test those limits. It is part of their way of learning how the world works and how far they can go without coming to harm. Don't descend to the level of the child. Stop and think about what you want to say and proceed with corrective teaching. Sticking to one issue.
Kids are experts at sidetracking.
Deal with one thing at a time. You can always go back to other issues after the main one is resolved. Learning age-appropriate discipline techniques. There are lots of resources out there for learning effective discipline for various age groups. Kids feel safer and more loved if the same rule applies all the time.