The order of components in a series circuit does not matter [1]. Consider a hydraulic analogy: a wire is like a hose, a diode is like a check valve, and a resistor is like a pinch in the hose that restricts flow. You want to limit the current (water) that can flow in the hose. Does it matter where you pinch it?
[1] at least, not until the speed of light is slow relative to the operation of the circuit. See How does the current know how much to flow, before having seen the resistor?How does the current know how much to flow, before having seen the resistor?