PC817 is an optoisolator consists of an infrared diode and phototransistor. In electric circuits, we use mostly filters to remove noise. The circuit based on the capacitor and resistor always removes the noise from the incoming signal but the value capacitor and resistor always depend on the incoming signal. This circuit is only applicable where the incoming signal has some information or data but when we just need to forward the signal from one part of the circuit to the other part but signal contains noise, then we could use the combination of IR sender and receive.
In PC817 photoisolator IC circuit, the IR receives the noisy signal as a power from the one circuit and passes it to the other part through the IR signal. The other part receives the signal and then performs according to the circuit design.