Organisms can be unicellular (made of only one cell) or multicellular (made of many cells). The shape of a cell determines its function (or purpose). The way in which a unicellular lives is largely dependent on its shape. For example, the fluid-filled pseudopods of an amoeba enable it to engulf (wrap around) food in order to consume them.
Multicellular organisms are made of many different cells. Each cell has a different shape that allows it to perform a specific task in order to contribute towards the overall function of the organism. Specialized cells in multicellular organisms are needed simply because of their sizes! In order to complete the requirements of life, the workload needs to be divvied up--and divvied up well--by specialists!
When an organism evolves a multicellular body, there are complications that can be addressed by having cells perform different functions. Because cells deeper in the organism depend on surface cells (nutrients, gas exchange, etc.) surface cells evolve to provide these to interior cells with their needs. But this means interior cells can evolve to do other beneficial things for the organism, like digest large macromolecules or filter fluids in the body to get rid of waste. Different cells are investing their energy and protein production to give the entire organism an advantage. This leads to being more competitive with other organisms, thus having advantages leading to greater survival and opportunities for reproduction.