While there are specialized devices that, while similar in appearance to an op-amp, are focused solely on comparing one voltage to another changing the output depending on which signal is greater.
A comparator is a specialized op-amp circuit that compares two input voltages and produces an output that is always at either one of two states, indicating the greater or less than relationship between the inputs.
Electronic Devices : Conventional Current Version, 9th Edition by Thomas L. Floyd
A comparator is a circuit that compares the signal voltage on one input with a reference voltage on the other.
Grob’s Basic Electronics, 11th Edition by Mitchel E. Schultz