No - you can’t ‘cancel’ anything from the top and bottom of a fraction unless it’s a common factor of the numerator and denominator.
Example - 11/18 doesn’t cancel to 1/8.
That’s because the digit ‘1’ isn’t a factor of either - it’s just something that appears on the top and bottom of the fraction.
So it doesn’t matter that ‘x’ *appears* on the top and bottom of the fraction. It’s not a factor, so you can’t ‘cancel’ it.
I run into this misconception all the time with my students, so you’re not alone. :)