Hello and welcome to Just Answer
This is usually caused by a faulty crank angle sensor - the heat stops them functioning properly and when they cool down they are ok again for a while.
They are located on the engine block on the opposite side to the starter motor.
They run to about $60 on ebay last I looked.
Simple to do - two bolts and a plug.
A few minutes work.
Happy to help.
Thank you for the bonus.