Generally, 上瘾 is used to describe something bad, for narcotics, play game, or something that doesn't do you any good, you can use "上瘾", but for playing game, you can also use "沉迷".
For 沉迷, if you are crazy with your specific hobby or something that is useful to you, you can use it, for example, 我沉迷于画画, 我沉迷于弹钢琴, 我沉迷于学英语, etc......
But in some specific contexts, they can be interchangeable.
I hope this helps.