Distracted usually has a neutral or slightly negative connotation as being distracted implies that it's the person's fault, to some degree, and that their lack of focus, agency, or distractibility led to them becoming distracted. The below don't necessarily all mean 'distracted,' but they imply that you had something else you had to focus on.
I got 'sidetracked.' Neutral-negative
I got 'pulled in another direction.' Neutral-positive. Depends on context, if there was a more urgent matter you had to attend to, this phrase is helpful.
I had to 'switch gears,' but I'm refocusing on X right now. Neutral-negative. It could show you are managing your time well, or it could possibly be slightly offensive as it could imply that you value the other task less or assign it lower priority, rightly or wrongly.
'Something came up' that I had to deal with. More on the negative end of neutral.
'I had a fire to put out.' This implies you had a more urgent matter to deal with, but not necessarily an actual emergency.
'I got roped in to something else.'