Like you said, the 16F84 has less pins than the 16F877A, so it's not a match in physical size, i.e. not a drop-in replacement part. The most direct, current production replacement part for the 16F84 is the 16F88 (identical pin-count and a few more features).
The 16F877A is a more powerful chip than the 16F84, so anything you might have done with the 16F84 you could do instead with the 16F877A.
I think he's asking if he can, for instance, interchange the PORTB.3 pin on the 16F84 with whatever the PORTB.3 pin might be on the 16F877A? I'm guessing yes if he's only interested in TTL I/O. As long as the same port pin on both PICs has the same function (which more often than not, they do) then there shouldn't be a problem. Check the datasheets for both PICs and make sure the pin functions of the 16F84 match up with the equivalent port pins on the 16F877A. I'm guessing it will be close if not the same, with the exception of there being more function options (like CCP) for some pins on the 16F877A.