Pope Leo XIV said he would undergo surgery after doctors found a "localized nodule" in his lung.