At least one patient in Tayside had to wait more than two years to be discharged from hospital, despite being fit to leave.
Around seven people had to wait for more than a year in 2018, and of those, at least one faced a delay of more than 24 months.
Almost 1,800 people experienced delays of up to three months, according to new figures.
Of the total who were waiting to leave, 20 died while in hospital despite being told they could go home or into care.
Health bosses said some of these people had terminal illnesses such as cancer and others died naturally from old age.
Critics say delayed discharges, commonly known as “bed blocking”, are having an impact on many more people by holding up their admission and treatment.
Angus Scottish Conservative MP Kirstene Hair said: “I have deep sympathy for the small but significant number of people who waited years, not even months, to leave hospital.
“It is only right that when a patient has been medically discharged that they leave hospital and move into more comfortable surroundings as soon as they can.
“And experts warn a lack of suitable accommodation can impact on health.”
She said the SNP Scottish government promised to ‘eradicate’ delayed discharge in Scotland in 2015, but by February this year, it had gone up by 9%.
Since 2014, delayed discharges have cost the Scottish NHS an estimated £500 million.
NHS Tayside said there were numerous reasons for the hold-ups, including patients waiting for admission to care homes, social care assessments, provision of equipment or care at home services.
A spokesperson said: “Our commitment to patients is that they should not have to wait unnecessarily for the most appropriate care to be provided after treatment.
“NHS Tayside has been working very closely with the three health and social care partnerships and third sector partners in Angus, Dundee and Perth & Kinross to build sustainable solutions that seek to reduce unscheduled care and demand, and avoid unnecessary delays in discharging patients from hospital.”
The spokesperson added: “Some patients may have highly complicated health and social care difficulties, and need specialist, high quality care provision after discharge from hospital. This will be tailored to the needs of the individual service user and arranged in conjunction with the three health and social care partnerships, and with community providers.
“There can be delays in arranging this type of specialist provision. Reasons for this include the recruitment of skilled care staff, and also the need for housing to be adapted to the needs of the service user. Sometimes the patient’s needs can change after a period of stability, and it can also take time to get necessary legal safeguards in place before someone can be discharged home.”