The exterior of an ant is tough (please don’t test this by stomping on them!). It both protects them, and also serves as their inside-out skeleton, giving their bodies definition and form. Exoskeletons are much more efficient than interior skeletons (like humans and other vertebrates) because they can serve these two functions instead of just one (support). However, they are usually less flexible than interior bones or cartilage (like sharks have), and so ant size is constrained by their need to move combined with their exterior shells. This means that ants can never grow as big as dogs.
Why exactly? Physics! As explained on the educational site Understanding Evolution, “An extra-wide exoskeleton must be extra heavy, and that clunky armor would require extra strength to move it. But unfortunately for our ambitious ant, its muscles can’t get stronger at a pace that competes with the extra weight the exoskeleton adds. A large terrestrial arthropod with extra-wide legs and a crumple-proof exoskeleton just wouldn’t have the muscle power to move itself around!”