Hello it may be caused due to EMI (Electromagnetic Interference) problems.
If you are using same power supply for relay and LCD, make sure that you are using proper filtering capacitors.
Add proper power supply decoupling capacitors near to the VDD and VSS of PIC, LCD etc. Try with parallel combination of 10uF and 0.1uF. If it doesn’t works use 1nF, 100nF and 4.7uF in parallel.
If you are using long wires to LCD, reduce its length.
Make sure that there is sufficient delay after each LCD write.
Also check whether the clock frequency in the project settings and hardware / simulator is same.