Test against voltage
The function you are looking for is called a comparator.

Unfortunately, you'll find out it's much easier to design a good comparator in an IC than build one from discretes. IC comparators are available for $0.50 each. It may be an interesting academic excercise to build one, but the engineering solution should be to buy it.

If you still want to build one from discretes, the typical circuit is called a long-tail pair. For a comparator you would choose the component values in this circuit to give very high gain, or probably even add a second amplifier stage, so that even small differences in the inputs cause the output to swing full-scale. On the other hand you also might want to limit the saturation currents through the transistors so that the circuit can respond quickly when the input changes.