Do time dilation and length contraction cancel out?

There is a lot of confusion here. Also in Special Relativity is fundamental to be clear about what we mean when we write variables, especially when dealing with multiple frames of reference.

Let's treat things properly: given two frames of reference (so two observers if you like this name better) $O$ and $O'$, in relative motion with respect to each other with constant velocity $v$, from the point of view of $O$ the equation regarding time dilation and length contraction are: $$t'=\frac{t}{\gamma}$$ $$l'=l\gamma$$ but these equations by themselves do not mean anything! We have to really understand what $l,t,l',t'$ are to make use of these equations.
Well: $t,l$ are measurements of time and length respectively, made by $O$ on an object that is still in the frame of reference of $O'$. On the other hand $t',l'$ are measurements made by $O'$ on the same object. So, to get the picture in your head: $O$ sees the object being measured as moving, while $O'$ doesn't.

You can easily remember these equations by the names of the phenomena that they describe: time dilation roughly means that the time elapsed from the point of view of $O$ ($t$) is greater compared to the time elapsed from the point of view of $O'$ ($t'$), and we know that the proportionality constant should be $\gamma$, but since $\gamma$ is always greater than one we immediately see that: $$t>t' \ \Rightarrow \ t'=\frac{t}{\gamma}$$ but be careful: this is not at all a proof! It is simply an useful mnemonic technique to remember the formula.
You can of course do the same with length contraction, but this time $l'>l$.

Keep in mind also another thing: online or on books you will definitely find sources reporting seemingly the exact opposite equations that I reported, but just remember to pay attention to the meaning behind the letters and all the incongruencies should vanish.

Also remember that this phenomena work in both ways, $O$ sees $O'$ moving, but from the point of view of $O'$ is $O$ that moves, so the phenomena are completely symmetrical! This usually seems really strange at first, but with time you will get the hang of it. Hope to have spared you some confusion.

Now you should be able to see why your reasoning is incorrect.