Cells can differentiate their functions.
Job specialization (like the different functions of eye cells vs stomach cells) occurs as a result of cells controlling certain parts of their gene expression. When a gene is expressed or repressed, it has an effect on what the cell can do and thus that cell’s impact on the entire body.