Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

When singer Selena Gomez found out she needed a kidney transplant she discovered the daunting reality: it can take many years before an organ from a deceased donor becomes available. She also learned the process can be dramatically sped up if a living donor can be found. For Gomez, that was her best friend, Francia Raísa.

Gomez and Raísa talked about the secret kidney operation they underwent earlier this year in an exclusive interview with NBC News. Their hope is to help others going through similar health problems.

There will be about 19,000 kidney transplants this year with one-third of the organs coming from living donors and two-thirds coming from deceased ones, according to the National Kidney Foundation. There are more than 100,000 people waiting for a kidney transplant in the U.S, with more than 3,000 patients added to the list each month.

Gomez has been battling the autoimmune disease lupus, which caused her to kidneys to fail. Because the demand for kidneys from deceased donors is so high, she was facing a years-long wait, she told NBC News. She knew she’d have to go on dialysis well before a kidney became available.

Kidney disease is rampant in the United States, a side effect of the high incidence of diabetes and high blood pressure, said Dr. Gabriel Danovitch, medical director of the kidney and pancreas transplant program at the University of California, Los Angeles.

Related: America's Obesity Epidemic Reaches Record High

A patient’s spot on the donor list isn’t determined by the severity of their illness.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Instead, it’s based on “a combination of things, including time on dialysis, and how long they’ve been on the waiting list,” said Dr. Amit Tevar, surgical director of kidney and pancreas transplantation at the University of Pittsburgh Medical Center. “The best option for many is a live donor transplant, because it allows them to immediately come off the list and be transplanted as an elective surgery," Tevar said.

But finding a living donor — someone who is not only willing to part with one of their two kidneys, but who is also a good match in terms of blood and tissue type — can be a major challenge for the average patient.

Raísa, an actress on the upcoming Freeform show, “Grown-ish," remembers the day when she learned that her friend would need a kidney. “She goes, ‘I don’t know what to do, the list is seven to 10 years long,’” Raisa told NBC News. “And it just vomited out of me, ‘Of course I’ll get tested.’”

'Swap' donors to help patients

Gomez was lucky: Raísa was a match.

“It’s incredibly difficult to find a match,” Gomez said. “You could have your entire family tested and nobody could be a match.’”

Even if Raísa and Gomez hadn’t been compatible, transplant centers around the country now are cooperating to “swap” donors.

“In previous generations you had to have a donor that was suitable and compatible,” Tevar said. “Now you just need someone suitable. If they’re incompatible, we can put together a live donor exchange.”

The exchanges can involve "chains" of many donors and recipients. A suitable donor must be healthy, as well as emotionally and mentally able to deal with the procedure, which includes a very small, but real risk of death that comes with any surgery.

"Living donation is our big opportunity for improving kidney availability in the U.S.," said Dr. Joseph Vassaloti, chief medical officer at the National Kidney Foundation. "There are a fixed number of deceased kidney donors, but a much broader pool of potential living donors."

Transplant centers make sure living donors know what they’re getting into, including writing a will.

“They make you take a two-hour course to educate you on what giving up a kidney means for your life,” Raísa said. “And so it was just a scary process, learning everything.”

But to encourage living donors, there are important built-in protections.

“The doctors and team who evaluate the donor are separate from the team that looks after the recipient,” Danovitch said. “That way we treat the donor as a patient with all the rights and benefits of being looked after as an individual, not just as a donor for someone else.”

Ultimately, there’s the emotional reward from knowing you saved someone’s life, Danovitch said.

“I’m actually really honored and grateful that I was able to do that for her,” Raísa said.