The Moon druid’s Elemental Wild Shape feature (and possibly some vanilla Wild Shape options)
The Circle of the Moon druid’s Elemental Wild Shape feature description states:
At 10th level, you can expend two uses of Wild Shape at the same time to transform into an air elemental, an earth elemental, a fire elemental, or a water elemental.
Of these, the air, fire, and water elementals have traits that allow for moving through spaces as small as an inch.
This method possibly extends to any druid, subject to DM ruling. There are stat blocks for some very small creatures, such as a spider, and your DM may allow you to Wild Shape into a sufficiently small spider.
At 20th level the Archdruid feature allows Wild Shape to be used an unlimited number of times.
Using either the true polymorph or shapechange spell, one can transform into any of the numerous monsters with the Amorphous trait:
Amorphous. The [creature] can move through a space as narrow as 1 inch wide without squeezing.
This method also works for the elementals mentioned in the last section.
The gaseous form spell works as well:
While in this form, the target's only method of movement is a flying speed of 10 feet. The target can enter and occupy the space of another creature. The target has resistance to nonmagical damage, and it has advantage on Strength, Dexterity, and Constitution saving throws. The target can pass through small holes, narrow openings, and even mere cracks, though it treats liquids as though they were solid surfaces.
This spell also has a potion version that applies the effects of the spell.
As Deeds observed in this answer, Eberron: Rising from the Last War features a very rare magic item called Kyrzin's Ooze that can grant the ooze's Amorphous feature to the character for 1 minute, once per day. While this technically fulfills the role asked about in the question, it's going to be a tough fit as a sort of "generic" option. It's an item tied very closely into the lore of Eberron, and the magic item description even references the Daelkyr, the emissaries from Eberron's Realm of Madness, Xoriat. Apart from true resurrection, dying while attuned to this ooze likely means you cannot be resurrected:
If you die while the ooze is inside you, it bursts out and engulfs you, turning your corpse into a black pudding allied with the daelkyr