Hi 宇翾,
What you are looking it is something called "interrupted actions" using the past continuous.
Interrupted actions:
In this case we start with an action that was happening for a long period of time, until it was interrupted by something else. "I was working when the door bell rang". As you can see, the actions were not happening at the same time necessarily or for the same amount of time either. If you said "I was walking past the car when it exploded," that is correct. It just means that the action of walking was interrupted by the car exploded.
However, to say "the car exploded while I walked past it" is also grammatically correct. You can use the past simple twice in a sentence when both actions are in the past. The only difference is that it implies that there is less of a connection between the actions. Before, they were connected by one interrupting the other, now it seems more like they just exist together.
Overall, you are correct when writing both.
If you have nay further questions, feel free to get in touch
https://www.italki.com/maddie.