Generally speaking SMD resistors have lower voltage ratings than through hole .The older larger through hole resistors were used in valve circuits.Whats done these days is placing several SMD resistors in a series string to get the voltage rating.Because SMD parts are machine placed in production the extra component count is not seen as a penalty.Remember that the price of machine placing one part is a very small fraction of the cost of through hole hand placement .Some SMD resistors have laser cuts on them to get the right value .This can mean focused electric fields that reduce the voltage rating.Hence length is not going to always mean a high voltage rating.
I agree with @Autistic and I'd like to add some of my experience.
1) When it comes to sink power from mains (small resistor values). Use through hole resistors with 100% more power dissipation than the calculated value. Also avoid flammable resistors. Avoid carbon, metal film or metal strip for ex. A wirewound resistor is usually a very good choice.
2) When you just have high voltage drops (large resistor values). Use a series network with resistors (for ex: 1206 1/4W). 3-4 1206 resistors in series for 230VAC and 4-5 for 400VAC are good numbers. Again the resistor network voltage drop is higher than the calculated. Also here you can use a wider range of resistor technologies. Metal film for ex.
Reason for both "over-engineering" values is noise and spikes. If your design is for an industrial application it wont last a month with the calculated rated voltages and power.
Resistance: this is the parameter that tells us how much current will pass at a given voltage. It is usually why we use a resistor
Power dissipation:As we apply a greater voltage, we need to worry about the power \$V^2/R\$. This is a bigger concern for small resistors. Usually you look at the power rating of the resistor to make sure that the calculated power can be safely dissipating without the resistor getting too hot.
Voltage drop: As a larger current flows, the voltage drop increases - and so does the electric field across the surface. If you do not take special precautions, there comes a voltage at which arcing can occur across the surface. The probability of this happening depends on the surface condition (contamination, asperities, ...), the relative humidity, air pressure, and other factors. Since the resistor manufacturers don't control many of these conditions they specify a "safe" voltage at which the package will usually behave itself. Since this has more to do with the form factor than the resistance value, the rated voltage is independent of resistor value.
When you need a certain combination of voltage, power and resistance rating, and you are stuck with a given form factor (SMD package), you may have to use series (spread the voltage drop) or parallel (spread the current/power) equivalent circuits.
Don't design a circuit with components at or near the limit of their rated performance. The fix will cost you far more than just doing it right the first time. Electronics has a way of testing for sloppiness and punishing you...