Placement of passive RC filter components on PCB
I assume you are reading the analog signal of your sensor using the analog to digital converter of your microcontroller, right?

If so, place the RC filter close to the ADC. That way the filter will also be effective filtering out all the noise that you've picked up over the long trace.

If signal integrity is a concern and the analog signal has a high impedance you may also want to put an opamp configured as a voltage follower just behind the sensor. That way the signal over the trace has low impedance and is less prone to noise pickup.