Do I need a Visa?

We are 2 people from Spain. We are traveling from London (UK) to visit Vietnam and Cambodia. But we have one question.

The total of our trip will be 15 days. First, we will be visiting Vietnam for 12 days, so we don’t need the visa for this visit. After, we are going to Siem Reap (Cambodia) for 3 days and we don’t need the visa either.

The thing is that to come back from Cambodia to London, one of the last tickets to fly back to London is departing from Siem Reap to Vietnam (Ho Chi Minh), arriving at 22:30pm. Then, we have our second ticket from Ho Chi Minh to London at 2:30am the same night. That would be our second entrance in Vietnam so we will need the Visa for what I understood. Only if the company make us pass the border. But we are just going with bags, so we won’t need to pick up our luggages outside. We wouldn’t need to enter Vietnam for the second time and a Visa, because we are not going to need to pass the border as we will just be in the airport to take another plane, but we don’t know how you do it with passengers like us.