Final answer:
The nucleus serves the stated function in both eukaryotic and prokaryotic cells by storing genetic material.
Step-by-step explanation:
The cell structure that serves the stated function in both eukaryotic and prokaryotic cells is the nucleus. The nucleus stores genetic material, including DNA, which contains the instructions for cell processes and inheritance. While prokaryotic cells do not have a true nucleus, they still have a region called the nucleoid which houses their genetic material.
Learn more about Functions of the nucleus in cells