How are the distance and speed of a galaxy related?
You have the answer to your own question in the title. If you just googled Hubble's law you would have found lots of answers. Here is one of them.
They are related by so called Hubble law which really relates the distance and the observed redshift of a given galaxy which is assumed to be proportional to the "speed of recesion" of the galaxy v. The observed redshift is converted to the assumed "speed of recession" through the Doppler law, which for small Z's is v = Z c, where Z is observed redshift, and c the speed of light and then the distance is calculated from d = v / H, where H is Hubble constant (presently about 70 km/s/Mpc, Mpc being about 3,000,000 light years).
Separate names with a comma.