You can use a scan tool to check actual operation of the EGR valve. If the scan tool detects an error code, then it’s likely that the sensor has gone bad and will need to be replaced.
Also inspect the tubing that runs from the exhaust manifold to the EGR as sometimes this can get clogged, restricting flow, which will cause drivability issues. You’ll be able to identify this by running the engine and then disconnecting the tube from the EGR. If you can’t feel any vacuum pressure and the engine idle doesn’t change, there’s a clog somewhere in the system, as normally a leak in the EGR system, with exhaust gas still recirculating, will cause the engine to run rough. However, in most cases the EGR rarely fails, and there may be a problem elsewhere.