265/35R18 is 0.73" shorter than 255/40R18, a −2.80% change in diameter, inside the 3% range most shops treat as a safe swap.
Ground clearance changes by 0.36" (half the diameter change), and the tire needs 0.36" less room above it.
265/35R18 is 0.39" wider. On the same wheel offset about half of that, 0.20", moves toward the suspension and half toward the fender.
Both fit a 18" wheel; the sidewall is 0.36" shorter on 265/35R18.
Details: 255/40R18 in inches · 265/35R18 in inches · change sizes in the calculator