As it seemed Spiderman had died he was disintegrated and thrown back into his universe, just in time to fight Thanos. While he starts swinging back to the fight he goes, "I'm back New York!"
THE END I made for something telling us what happened back while spiderman (and other heroes) had died because we don't really know what happened.