The Republican served for almost three decades in Congress. He said he was withdrawing from public life after the diagnosis.