Having separate tickets, indeed you need to apply for an electronic visa, depending on your nationality. Some countries are visa-exempt. Check your country's immigration website to get to the Vietnam e-visa application portal (do this as early as possible, if you proceed with your itinerary).