As a rough guideline, from their last interview (or the last time you had contact with them):
Less than 1 week is the ideal time-frame to notify a candidate of rejection (but not a time-frame too many companies achieve).
Between 1 week and 1 month is getting a bit slow, but this is still a common time-frame for companies and you could expect most candidates to still be waiting for an answer.
Between 1 and 2 months would be pushing it. I wouldn't expect many candidates to still be waiting, but I would still suggest sending a notification, as many will probably appreciate it.
More than 2 months is generally too much, and you should probably just leave it. Some candidates may still appreciate a notification, but basically no-one would still be waiting for an answer and beyond that a decent number of candidates will start forgetting that they even applied. After too long candidates will start wondering what sorts of problems there are at your company that would cause such a delayed response (which could dissuade them from considering a role at your company again in future).
If they only applied and you haven't interacted with them at all yet, they may expect feedback to take a bit longer, but the 2-month threshold still roughly applies. Although this is only about negative feedback. If you want to invite them for an interview, this can happen much later. Consider that it's not too rare for companies to keep candidate information on file to potentially reach out to them about future opportunities, and companies often even reach out to people who've never applied.
Of course the better guiding principle here is that you should, in general, let them know as soon as you've made a decision.
You should let them know as soon as you've decided they won't proceed to the next round or won't get an offer.
If it takes you, say, 4 months to make a decision about one particular candidate after a particular interview, that would be quite long and you should work to decrease that, but it would be more reasonable to let a candidate know after such a long time if that's just how long you took to make the decision. Ideally you would at least let candidates know how long you'll take to make a decision (roughly speaking). This is helpful information whether it takes 4 months or 4 hours to get feedback.