I was struggling with a similar problem (2007 Yukon Denali XL 6.2 226k) that would stall after driving about 30 miles when pulling up to a stop light or sign. It'd stall and refuse to start for 20+ minutes without ever showing a code. Had this problem for 3 months. Tried a bunch of things: replace fuel pump, Cleaning Throttle body, Mass AirFlow Sensor, running injector cleaner through tank, replacing crank sensor. Changing oil did seem to help a little bit-- the truck would idle really rough instead of immediately stalling. Bought a cheap code reader on amazon (
https://www.amazon.com/gp/product/B08Q3TSC9D/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1) and after watching it it stall a few times I noticed that my evaporative pressure seemed to go really high positive pressure. I replaced the Evap Purge Valve. Immediately after replacing I went for a drive and the truck's dash light up check engine, vsa and traction lights, then went into reduced power mode. The code was a P2138 and mentioned something about Accelerator Pedal Position Sensors being not plausible. Watching the sensors when I drove it, I did notice 1 of the 2 sensors would spike contrary to the other unexpectedly. Replaced Pedal and swapped out gas cap. Since then, I've driven 400+ miles so far without stalling.
TLDR; Replacing Evaporative Purge Valve, Accelerator Pedal (with sensors), and gas cap seemed to fix my similar issue.