Distracted: your mind is working/thinking, but not about the right thing. It is a problem of attention, generally.
Confused: your mind isn't working right/isn't thinking about something correctly. It's a form of misunderstanding something.
You can be distracted by thoughts, worries, fears, or physical things in the environment like noises, sights, sounds, vibration, a flashing light, etc. We're often distracted by more appealing things; i.e. wasting time on social media instead of working.
Confusion, in some cases, can be medical problem such as with dementia, alzheimers, or some kind of other impairment. Or, it can just result from misunderstanding something, making a false assumption, having incomplete info, etc.