"Estuve en México por un mes."
Translation:I was in Mexico for a month.
My understanding is that you often use the preterite when a specific time period such as one month is mentioned. There are a variety of reasons why you would use either preterite or imperfect, but you could use the imperfect if you weren't specific about how much time "Estaba en México." In that case, it's not clear when you were there or for how long.
Can someone explain to me the difference between using estuve and fue, and what context does it follow?
Duo's sentence is talking about your location. Location uses estar.
(Unless you are talking about the location of an event like a meeting or a party. Then use ser.)