Difference between PIC16F877 and PIC16F877A?
The A versions of Microchip devices are simply improved versions. You might see a difference if you examine the errata documents. They are usually cheaper.

There should be no problems if you interchange the two versions.

Microchip advises switching to the PIC16F887, from both devices. It's a much better chip, and is a lot cheaper than either of them.