eng_ahmed22,
Any op-amp can be used as a comparator. However, you must be careful about oscillations and noise. When the input is equal to (or very close to) the referenece, any noise that is present on either the input or reference will show up on the output in highly amplified form. The output will probably not be symmetrical, so there will be a DC component. This is probably what you are measuring. The best way to avoid this situation is to provide some hysteresis (positive feedback) to keep the amplifier out of its linear range. This precaution also applies when you are using a "real" comparator.
~
Most comparator ICs have an open drain or open collector configuration. This is convenient for matching the input voltage requirements of the logic device that the comparator will drive. You just provide an external pullup resistor to whatever voltage you need for the "1" state.
Regards,
Kral