Naively, to achieve optimal access time, you can pack your memory within a sphere of radius R, and R=O(N^(1/3)).
But, for large R you start having cooling problems. If each memory element needs some power P to operate, then the total power consumption is P×N = O(R^3). But your area is only 4pi R^2, so the power flow per unit area is O(R)=O(N^(1/3)). So if it has large radius, and it has limited thermal conductivity, your memory will melt (since temperature ~ power flow^(1/3) (Plank's law)).
The threshold for stable temperatures at any radius is memory access as O(N^(1/2)).
This analysis is valid for general computing and circuits, but since computers are usually modeled as memory machines I think that's sufficient (?).
Obs: Why, or how, is the human brain roughly spherical then? Because we have a very effective (water based) cooling system. Still, if it got large enough, and you admit limited flow rates of water and such, cooling eventually would be limiting. If you immediately thought of elephants, so did I, and this may be linked to their fantastic large ears:
https://asknature.org/strategy/large-ears-aid-cooling/
I love how everything is connected.
Obs2: Yes this is related to the Bekenstein bound, but much more relevant of course (because existing RAM is almost thermally limited and you need black hole densities to achieve bekenstein bound). The memories we use are organized in (mostly) flat packages.