CMOS Inverter circuit
The probe shows 2.5V dc because that is the dc equivalent value of a 5V square wave with 50% duty cycle.

The "distortion" is caused by capacitive coupling of the fast transient voltage on the input to the output through the gate capacitance of the MOSFETs. Try using a slower rise/fall time for the input.

I think the thresholds of these transistors are higher than you realize. The circuit seems to be working just fine to me.