One school of thought separates the terms like this:
Think of a house. The framing of the house is the physical structure – the coding. The electrical system and the plumbing and the HVAC are the functionality of the house – the user experience. The window hardware, doorknobs, faucets, and paint are how the homeowner interacts with the house and their enjoyment of it – the user interface.
In that example, the two are separate entities. They rely on each other, but there is little overlap. If UX design only relates to the functionality of the house, then UX design would need to come first, and UI design would wait to step in after UX was completed.