Portrait Mode photos generally require an adequately-lit environment. While natural sunlight works best, you can always activate your flash to aid you in dimly-lit scenarios. While framing your portrait mode photo, the Camera app may ask you to move forward or backward to calibrate the effect. A general rule of thumb is to remain within 2-8 feet of your subject. If you do not have enough space in your environment to move around you can switch between cameras on newer iPhones with more than one camera lens.
Note: While using the 2x telephoto lens on select iPhone models, Portrait Lighting and depth effects are not available if photos are captured without proper framing.