Answer: Sloughed esophageal mucosa.
Although this has a superficial appearance of a worm, it actually consisted of a floppy tubular structure (not fully shown in the images) composed of the outer layer of this patient's esophagus. This is a well-described phenomenon that is most commonly seen in older patients who are receiving a number of medications. It has also been seen with infectious and bullous diseases. Here are a few references which describe this phenomenon:
Carmack et al. 2009
Purdy et al. 2012
Moawad et al. 2016
Fortunately, this is usually a self-limited condition and patients fully recover.
The following images are from a similar case that was donated by Dr. Julie Ribes.
Some readers also suggested that the original case represented mucous casts, which is another good consideration. However, mucous casts would appear more solid rather than tubular.
The most important consideration in this case is not to mistake the structures for worms, since that would lead the clinical team down the wrong path in their evaluation.
Many thanks to Dr. Ribes who provided the amazing images of her similar case, and to Dr. Grys for providing the original case.