The simplest way to see the difference is a checkout. UX decides how many steps there are, what is asked in each step, what happens when a card is declined and whether a guest can buy without an account. UI decides what each step looks like: the form fields, the button style, the error message colour and the small animation when payment succeeds.
UX design starts before any screen exists. It includes user research, interviews, journey maps, information architecture, wireframes and usability tests. The output is often a flow or a prototype rather than a finished visual design. Success is measured by outcomes: task completion, errors, time to finish and whether people come back.
UI design turns that structure into an interface. It covers visual hierarchy, spacing, typography, colour, icons, components and how each element behaves in every state: default, hover, pressed, disabled, loading and error. Motion is part of UI too. A button that responds when pressed, or a sheet that follows your finger, tells people the product has heard them.
The two depend on each other. A clear flow with confusing buttons still fails, and a polished screen on top of a confusing flow still fails. That is why most teams treat UI as one part of UX rather than a separate discipline, and why many job ads ask for both.
If you are deciding what to learn first, start with UX basics (understanding the user and the task), then learn UI skills in a design tool such as Figma or Penpot. Interaction and motion design come next, and that is where tools like ExodeUI, which we make, fit in.