Some people might get transplants before people who need a kidney(s) because of the importance of the organ.
All organs are important and play some role, but others more important.
An example of this is a liver. The liver is crucial to survive, without a liver your body wouldn’t be able to break down foods, clot blood, and pull away and create chemicals like insulin.
It makes even bigger sense for a person in need of a new heart to get a transplant before one person to get a kidney. Without the heart working or beating, you can die in a matter of minutes.
Hope this helps you in the long run!