In this article, we explain the main differences between the T distribution and the Z distribution.
Suppose that a given normal population has mean \mu and variance \sigma^2. Suppose we draw a sample of size n such that the sample mean is \bar{x}. Then the quantity Z= \frac{\bar{x} - \mu}{\sigma/\sqrt{n}} follows the standard normal distribution also known as the Z distribution.
When we do not assume knowledge of the standard deviation of a studied
random variable, we substitute the sample standard deviation s for the population standard deviation in the earlier equation. That is we obtain, t= \frac{\bar{x} - \mu}{s/\sqrt{n}}. In particular, due to using the estimate s of the standard deviation in the above equation, the resulting test statistic t in it does not follow a standard normal distribution but instead follows a different distribution. The distribution of the right-hand side of the above equation is referred to as the t-distribution.
Each one of these distributions differs from any other of the class of t-distributions by an associated quantity that is called degrees of freedom, commonly denoted as df. This quantity, df, is always an integer number, i.e., a whole positive number. The degrees of freedom (df) associated with the t-ratio in the above equation is df=n-1.
1. The Shape of the Distribution:
The Z distribution had a shape similar to that of a bell-shaped curve. Note that the normal distribution is always symmetric.

The shape of the T distribution depends on the number of subjects studied, i.e., on the number of subjects in the sample. Another property of the t-distribution is that its shape approaches the standard normal distribution with increasing degrees of freedom. The probability density function (pdf) of the t-distribution is somewhat flatter and ‘‘shorter’’ than that of the standard normal. A characteristic property of the t-distribution is that its tails are thicker than those of the standard normal distribution, and thus it rises to a lower level.
2. Use of the Distribution:
Both of the distributions are used when testing the value of the population mean for any given population. The difference is that the Z test is used when the population standard deviation is known whereas the T distribution is used when the population parameter is unknown.
Also, the T distribution is generally used when the sample size is small (less than 30) whereas the Z distribution is used if the sample size is large (more than 30).
Reference:
Basic Statistics, An Introduction with R – TENKO RAYKOV, GEORGE A. MARCOULIDES