Engine computers have 2 basic states they operate in, Open Loop and Closed Loop
In Open loop O2 sensors can not be used so computer uses factory tables in memory to calculate air:fuel mix based on RPM.
Closed loop means computer can use O2 sensors so it has Feedback on how to adjust the air:fuel mix.
O2 sensors do not work until they get above 650degF.
When a fuel injected engine is cold computer runs it in Choke mode, part of Open Loop
High idle(1,200rpm), rich fuel mix, advance spark timing is what choke mode is.
Since a fuel injected engine doesn't have jets(carb) an idle screw wouldn't work well, so the IAC(idle air control) valve is used, this is basically a controlled vacuum leak operated by the computer.
As the engine/coolant warms up the computer slowly closes the IAC Valve until "target" idle RPMs are set, target idle is different for each engine trans and year.
2.5l with auto might have 900rpm target idle
2.5l with manual might have 750rpm target
But IAC valve can get dirty inside, so as computer close it for warm idle it can stick and computer can't unstick it so idle gets to low and engine stalls.
IAC valve can be cleaned.
EGR(exhaust gas recirculation) is not used when engine is cold, only after it warms up.
And a leak in this valve wouldn't effect a higher rich idle, 1,200+rpm, but would effect, warm engine idle causing rough running and stalling.
EGR valve can get carbon build up inside so valve doesn't close all the way.
This can also be cleaned.
And you could also just have dirty injector tips, run a can of Seafoam or similar gas treatment in fuel tank.
Injector tips spray fuel out to better mix with the air, when they get dirty fuel drips out so not as good of a mix, when engine is cold computer is adding more fuel so engine gets enough fuel, when warm at idle fuel delivery is at its lowest so that is when you can first notice dirty injectors.
CKP(crank position) sensor would be a long shot, cold or warm wouldn't matter, and this sensor doesn't fail, it is rare, and usually it is total failure when it happens.
CKP sensor is used for spark and fuel both so failure would cause dead sop of engine, no rough running, engine would just shut off like turning the key off.