The selection should be based upon the operating load.
In general, for normal PLC inputs, the 2 wire type is a good choice, as less wiring is required.
However, the 2 wire type has a relatively high leakage current, and some PLCs may not detect the OFF condition of the switch. The 3 wire type has separate signal and power lines, and so much lower leakage current. The outputs of 3 wire auto switches are either PNP or NPN, make the selection according to the specification of the PLC input.
∗Typical leakage currents:
3 wire type: 100µA or less @ 24VDC (e.g. D-M9B)
2 wire type: 0.8mA or less @ 24VDC (e.g. D-M9B(W))