You’re gonna need to understand how to work with XR in the engine, and here’s some resources for that as well. The video shows you how to get a project setup for AR without using the templates and knowing this will also give you most of the knowledge needed to swap between the two.
Documentation:
Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.