MATAMOROS, Mexico — Under a canopy on the edge of a squalid encampment, a young physician named Dairon Elisondo Rojas holds office hours every day from 10 to 4.

On a recent afternoon, he saw children with diarrhea, colds and asthma, among other ailments. Some he examined, treated and sent on their way with cough or cold medicine. For those who required special care, like a boy with a broken leg, Dr. Elisondo arranged a transfer to the local Mexican hospital.

Dr. Elisondo, 28, a native of Cuba, is the sole full-time doctor in the teeming tent city that has sprouted at the base of a bridge that connects the Mexican city of Matamoros to the United States. More than 2,500 migrants have squatted in the camp while their cases wind their way through immigration court in Brownsville, Texas.

He makes $30 a day.

“This is perfect, perfect,” Dr. Elisondo said in Spanish about the arrangement. “It’s what I know. It’s what I do best.”