It turns out there are lots of data structures that are commonly used for this, which might be why you've had trouble identifying a single canonical recommendation. Each one has different characteristics and trade-offs.
Check out the Wikipedia article on nearest neighbour search for an overview, and specifically the fixed-radius near neighbours flavour which is probably most relevant to what you want to do.
One relatively simple method suggested by the second link is to divide your world into a grid of square (2D) or cubic (3D) cells. Each cell becomes a "bucket" into which you record your entities, moving them to a new bucket as they travel around the world.
When you want to find the nearest neighbours to a given entity, then they must be either in the same bucket or one of the 8/26 adjacent buckets (assuming your search radius is less than or equal to the bucket spacing).
For a large world and with entities that aren't super-tightly concentrated, this can let you skip evaluating the vast majority of entity pairs when searching for neighbours.
Of course, even from this high-level description, there are many implementations possible. The bucket lookup device could be a hash table, which itself can be implemented multiple different ways. It's likely to be difficult to identify which implementation is objectively "best" for a given game, so instead I'd recommend focusing on implementing it in a way that you find clear and friendly to work with first. If that version turns out to be a performance bottleneck in practice, then you can post a new question with the specifics of your implementation and profiling results, either here or on the Code Review exchange, to get suggestions for how to eke out more performance.