Why is the engine make a knocking sound when idling not so much w u ouch the gas on 1997 Mercury Sable

There is a loud knocking sound coming from top end twards ack of motor but when you push the gas a bring the rpm it don't knock as loud

Asked by for the 1997 Mercury Sable
Possibly the camshaft sensor pedestal is wearing out.
How would One go about testing it to see if that is what it is
You can use a stethoscope if you have one, or a long screwdriver that you can out against it and put your ear to the handle. You may even be able to "feel" it moving inside if you touch it. The best way would be to have a tech check it out for you.
the motor is a 3.0 but its not a dual over head so if you would be so kind as to poss send the specs on where the sensor is located i read something bout a pace that is know to breck off and thank you so much