In both cases, you'd really be better off amending the soil rather than just using soluble fertilizers, which you'll basically have to use forever without it ever doing any permanent good. Bone meal is the "classic" phosphorus amendment, and nitrogen rich compost is as close to "ideal" as you can get for nitrogen, and will generally enrich the soil (improve its overall texture, water-holding characteristics, etc) (You'd basically have to make that yourself, but you might be available to find composted manure, too, though you'll probably have to find a proper nursery or garden center for that, rather than being able to get it at a box store.) Neither one is a quick-fix though, so you'll want to continue using soluble fertilizer for some time, as well, though you should watch how much you use and test the soil periodically (once, maybe twice a year) to see how it's coming along, so you don't overdo the fert, which can be at least as bad, and can be significantly worse, than using too little...My lawn and garden are both Phosphorus and Nitrogen depleted, a 6.5 pH, and ample Potassium.
I am having a hard time finding fertilizers with Phosphorus. Most of the lawn stuff is 29-0-3 (N-P-K).
I have a little of this Vigoro starter fertilizer (20-27-5) left but it is expensive for the area it covers and designed for new lawn seedings. For the garden I purchased some Vigoro tomato and vegetable garden plant food (12-10-5) so I think I will be ok there.