You will pay capigal gain tax if you received 1031 "boot":
(1) Cash boot: cash leftover after sales of relinquished property and purchase of replacement properties.
(2) Mortgage boot: reduction of debt after 1031 exchange.
Example:
Let's say you have a relinquished property of 1 mil price and 500K loan. You get 500K cash after sale.
(1) You exchange to a exchange property of 800K with 500K loan, You pay 300K, you will have cash boot of 200K. This is subject to capital gain tax.
(2) If you exchange to a property with 800K and 300K loan, you pay 500K at closing, you have no cash boot, but 200K of mortgage boot. This is also subject to capital gain tax. Because you merely shifted the cash boot of 200K in (1) into the mortgage boot.