An insect is divided into three basic parts: the head, the thorax (or mesosoma) and the abdomen (or metasoma).
All insects share these same three parts and their bodies are divided in segments.
Learn more about ant morphology here:
Ants belong to the order Hymenoptera, a group of insects which first appeared around 250 million years ago. This group includes bees, wasps and ants with ants being classified in the family Formicidae.
Ants can be easily distinguished from other Hymenoptera by their elbowed antennae and their petiole (single or double), which is a distinctive node-like structure that makes their waists look slender and separates their thorax from their abdomen.
Some wingless wasps such as female individuals of velvet ants (Mutillidae) or pincer wasps (Dryinidae) may look like ants but pay attention to the presence of the "petiole".
Note how the thorax is connected to the abdomen. There is no petiole.
See the petiole in the form of a node between the thorax and the abdomen? This petiole is singe i.e. consists of one part.
This petiole is double i.e. consists of two parts. These are called the petiole and the post-petiole.
Now you should be able to distinguish an ant from other wasps.
These are rove beetles! They can be found in soil, under rocks and many areas where you will also find ants. They also come in many different shapes and sizes. They may look like an ant to you but look closely at their abdomen and thorax. No petiole, the thorax and abdomen are fused! Also, look at their box-shaped thorax, which is vertically split in two parts. Under those sheaths (also called elytra), which are their first set of wings there is another pair of hyaline wings. Elytra are a distinctive anatomical feature of beetles (Coleoptera).