Assuming we are not employing "ultra tech" and handwavium, the size of any megastructure on Earth will be limited by the structural strength of the materials. For practical purposes, we will probably use things which are relatively common and inexpensive, so your megabuilding will be built using structural members made of steel.
I have seen various designs for more or less realistic megastructures made of steel and concrete, Paolo Soleri had conceptual designs for arcologies built this way in his book "Arcology: City in the Image of Man" in 1969, including megastructures like the Hexahedron and Arcube which were to be over a kilometre high and have a similar width and depth
With modern techniques, it seems possible to build even larger structures, steel towers could be many kilometres tall, serving as the basis of launching tracks for space vehicles, for example.
Without a clear definition as to the reason and purpose of the building, I will say that a 5×5 kilometre cube does not seem beyond the bounds of possibility for steel construction of a building; a sort of mega arcology structure.