If you are specifying color as HEX values in a CMYK document, you will always get different values back.
HEX color is a way of describing RGB color.
RGB/HEX values in a CMYK document get converted to the nearest possible color that can be reproduced with CMYK inks.
Those CMYK values are converted to HEX and will be different.