It's crucial to consult a repair manual specific to your year and engine model (e.g., 5.9L or 6.7L) for precise location and removal instructions. A diagram will be extremely helpful. Pictures online can also be useful for comparison once you're looking at the engine.
Improperly handling the sensor or misinterpreting its location can lead to further damage. If you are unsure, it's best to consult a qualified mechanic.