Depends who it is... Depending on the reasons for getting pneumocystis and if your regular doctor is qualified (eg. Certified by the aahivm or belongs to hivma), he/she can also take care of it. In certain parts of the country, there are enough id specialists that can take care of patients with pneumocystis since many also require help in managing co-morbid conditions such as HIV or rheumatoid arthritis.
Pneumocystis. Best to see a specialist since this is a pretty uncommon infection and most general doctors will have little experience in managing it, unless they do a lot of hiv/aids work or cancer treatment. The other reason to see a specialist is that most pneumocystis occurs in the context of a disease that impairs your immune system, and this needs to be evaluated as well.