You should apply for disability benefits immediately after you realize that you can’t work because of your health.
Social Security will make you wait five months from the date that it determines you first had a qualifying disability to when you can start receiving benefits. But you shouldn’t wait five months to apply.
The process takes long enough that by the time you’re approved for benefits, the five-month waiting period will probably already be over. So it’s better to get your claim started as soon as possible.