What Is The Difference Between Gozaimasu And Gozaimashita?

What Is The Difference Between Gozaimasu And Gozaimashita? When you say “thank you” right after you received kindness or favor from someone, you say “Arigatō gozaimasu.” But, “Arigatō gozaimashita” is used when the action you’re thanking for is completely finished. When should you use Gozaimasu? So what’s going on with this? When you say “Good