Please fill out your profile - it will help you get better responses.
I assume you have an automatic transmission?
For the transfer case, there is a red tag with the model number that looks like this:
The tag is on the driver's side on the rear of the case. I think your XJ could have come with one of three transfer cases - NP231, NP242 or NP249.
Why do you think you need to replace them?
OK City probably has a Pull-a-Part wrecking yard, so you could try to get the transfer case from there. Or just rebuild it yourself - parts are readily available, and it isn't complicated.
For the transmission, it depends on auto or manual. I'm not sure that I would trust an automatic from a junk yard, but it might be cost-effective. If you can afford it, you might want to have yours rebuilt by a local transmission shop.