system
Given the following post, respond as if you're commenting on Reddit:
human
How do astronomers determine the distance and size of a star or exoplanet?
gpt
There are many ways to measure the distance to an object in space. For the closest stars you can use something called parallax.  
If you put your arm out in front of you and hold one finger up and look at it with one eye and then the other it will look like the finger is at different places! Now try moving the finger to different distances from your eyes and the "jump" in distance will be larger the closer the finger is to your eyes.  
This is because our eyes are separated by a small distance and if we know this seperation and the apparent difference in distance of the finger when looking with the different eyes we can work out the distance between the eyes and the finger.  
Now if you look at a star and blink your eyes like this you won't see any difference.. But if you look at a star today and then wait half a year the Earth has moved to the other side of the Sun and this effect will be measurable! And since we know the distance to the Sun we can work out the distance to the star we are observing.

Now if the object we are observing is to far away for this effect to be noticable we must use a different technique, and there's quite a few! The most common techniques include so called standard candles and red shift. A standard candle is something that always shines at the same intensity, that gives of the same amount of light no matter what. The most famous example of a standard candle are a special type of supernovae (SNe), namely type Ia SNe.  
These SNe occur when a white dwarf leeches material from a companion star. When the white dwarf has leeched enough material to reach a certain threshold, known as the Chandrasekhar limit, the white dwarf will explode and this explosion is very well understood and we know how much light it give out as they all occur under the same circumstances. By measuring the intensity of these SNe we can figure out the distance to the SNe since light intensity decreases with distance.  
Another standard candle are Cepheid variable stars. These stars vary in intensity and the period of their variation is tightly associated with its luminosity and be looking at how much of the light reaches us we can calculate the distance.  
As for red shift, that is for the very large scales! As an object moves through space the light it sends out gets shifted, just like a sound wave does which you can hear as an ambulance drives past you. As it approaches you hear a higher pitch and after it has passed you hear a lower pitch. The same thing happens with light waves. Because of the expansion of the Universe this means that objects separated by some distance will also be moving apart at a speed correlated to the distance, so by looking at how much the light has shifted we can see how fast the objects are moving compared to each other and at large scales this movement will be dominated by the expansion. (The light also gets stretched further from the expansion in another way but that's not necessary to think about here.)