Hi Kunal, I really appreciate you for asking this. Just to answer this briefly, UI & UX are both interlinked for sure and none of them are part of the other. However, they both share some common space.
Coming back to your question, UI is essentially a part of UX but you need that sense of UX to deliver the flow you want your user to experience through that UI. Read that again.
Giving a Login screen inside the profile screen can always be a great UI but still a bad UX.