Both Egypt's and Mesopotamia's development of civilization can be tied directly to being located along major rivers. In order to support their large populations, it was necessary to have large-scale agriculture. Both the Nile River in Egypt and the Tigris and Euphrates Rivers in Mesopotamia provided the conditions for fertile farmland. In fact, the land stretching between these two agricultural zones is often referred to as the "Fertile Crescent." These rivers provided annual flooding that replenished the nutrients in the soil. This meant that these areas could be farmed every year without depleting the farming areas of their fertility.
Both regions also benefited from a rich biodiversity of plants and animals. By being located between two continents, these zones benefited from plants and animals from both Africa and Eurasia. As a result, there were many plants and animals easily available for domestication.
Being situated along rivers and near coasts also meant that the civilizations in these two regions were able to build vast trade networks. Egyptians used the Nile River and the Mediterranean Sea to trade as far south as Ethiopia and as far north as southern Europe. Mesopotamian trade routes were extensive as well. The Sumerians, for instance, used their rivers to reach the Persian Gulf, where they were able to connect with merchants from Persia and the Indus River Valley.
There were differences between the two regions that led to different ways in which their civilizations developed as well. Egypt is bordered by deserts. Therefore, it was relatively easy to defend from invaders. Mesopotamia had no such natural protections and was subject to many conquests from outside peoples. As such, Egypt developed in relative isolation, while Mesopotamia had much more outside influence in its development.
Being in an arid environment, Egypt was able to stockpile grain without fear of it being ruined by mold. Consequently, Egyptians were relatively efficient at avoiding famines. Mesopotamia was a much more humid place. As a result, grain could not be stored for long periods of time. A bad harvest meant that there were often not enough reserves to ward off large-scale starvation.