It depends. There's no one right answer. If you're an experienced seller on eBay or Craigslist, you will likely get the highest value for your iPhone on those platforms. However, they do require more effort from the seller, charge fees, and come with risk of fraud that novice sellers may not know how to protect themselves from.
For those customers, we recommend using a trade-in site such as ItsWorthMore. Trade in websites leverage their volume discounts and industry know-how to provide a smooth streamlined experience; for a slightly lower payout.
Another alternative is to trade in your iPhone directly with your carrier or with Apple. These typically offer lowest payouts and often come in a form of a gift card. Carriers tend to run promotions at times, usually if you switch carriers. Under the right circumstances, they can result into a very high return for your device.
Some older iPhones especially non-functional ones, do not have much of a resale value and you can choose to recycle them. Recycling in an environmentally friendly manner helps to keep toxic pollutants, such as lead, out of the environment.