Yes, a Lightyear is a measure of distance. But since the light from the star is travelling at the speed of light then it will also tell you how old the light from the star is. If the light has travelled 3 million lightyears you are seeing light that has taken 3 million years to get to you. You are seeing the star 3 million years ago. The star may have died since then, but we won’t know until the light given off in its final moments reaches us.