In a situation where the President and Vice President are both incapacitated, the Speaker of the House of Representatives would be next in line. The Speaker would serve as Acting President until either the President or Vice President recovered.
This is prescribed in the Presidential Succession Act.