You seem to be confusing declaring (or creating) a variable with assigning a value (or changing) to a variable. If the variable is declared (i.e. int distance=0;) at the top of the code (outside setup() or loop()), its value can be assigned anywhere in the code (i.e. distance=55).
You need to create/declare the variable first (at the top) and then assign whatever value you want later e.g. distance=Serial.Read().