The discount factor is a number D - generally between 0 and 1 - that equals the cash amount one would agree to pay today in exchange for one currency unit in the future.
For demonstration let's assume the currency is USD.
Then one would agree to pay D right now for the promise to receive 1 US Dollar in the future.
To the extent that this promise is deemed to be 100% reliable, the discount factor is also termed as riskless discount factor.
The discount factor concept would be useless without the additional assumption that the following multiplicative property also holds:
The price today of X currency units received in the future equals X times the price of one currency unit.
Thus one would agree to pay DX right now for the promise to receive X US Dollars in the future.
For example, if X = 100 and D = 0.9 then one would be indifferent between the choices: a) receiving 100 dollars in the future and b) receiving 0.9*100 = 90 dollars today.

Obviously the discount factor must depend on the future time when the cash amount is expected to be received.
That future time is referred to as the maturity T of the respective discount factor.
Generally the further in the future a certain cash amount is received, the less is its worth today, which means the discount factor must become smaller as the maturity increases.
The only exception to that rule is when interest rates are zero or negative.

The discount factor must also depend on today's date t, as market consitions change in unpredictable manner that affect the prevailing interest rates that account for the difference in value between current and future cash flows.

Formally then the discount factor can be mathematically modelled as a function D of two variables t and T and written as D(t,T).
The discount factor also depends on the denomination currency of the future cash flow as well as the creditworthiness of the counterparty that promises to make the future payment.
Both of these variables are assumed fixed and thus are not explicitly named in the argument list of D(t,T).

If we arbitrarily designate the time instant now as t = 0 and also keep the first argument inside D(t,T) fixed at 0, then we end up with D(0,T), which can be viewed as a function of a single variable T.
This latter function effectively tells us the worth today (actually now) of any cash flow received any time in the future.
This function is commonly referred to as the "yield curve" and may be represented as a curve in a chart where the x axis is the time and the y axis is the discount factor.

When pricing derivatives, the yield curve is assumed known, as it can be easily inferred from the interest rates that are currently prevailing in the market.

The situation is very different when one sets t to a value greater than zero inside D(t,T) and still keep that value t fixed.
Then the resulting function D(t,T) - with t kept fixed - is still effectively a function of a single variable, but not a deterministic function any more, as each T does not correspond to a single discount factor value D.
Now each T is mapped to D(t,T), which is not a dimple number, but rather a random variable.
This is natural, as for a future time t, it is not possible to know with certainty what the prevailing discount factor is going to be.
For example, if a war takes place between 0 and t, the discount factor at t will obviously be very small.
It turns out, D(t,T) may assume all possible values when the time t actually arrives, and must therefore be mathematically represented as a random variable and not as a number.
It follows then, that when T is kept fixed but t is left to vary, the function D(t,T) maps each t to some random variable, a fact that turns D(t,T) into a stochastic process.

The conclusion is that in Finance the discount factor for fixed maturity T is mathematically represented as a stochastic process D(t,T).
It is a regular number only when t = 0.