The Fantastic Fangirls had a Q&A a few weeks ago asking what would happen if your favorite comic character wound up in your favorite non-comic story. This gave me a bit of difficulty because all the favorite stories I thought of didn't seem like great fits for Spider-Man at first glance.
My two favorite authors are Stephen King and Isaac Asimov. I did consider Peter in The Gunslinger, because it might be funny to have him out in the desert with nothing to swing from. Also, Roland wouldn't know what to make of his costume. Now that I think of it, with Spider-Man along, Jake wouldn't fall to his death in that book. Which means he doesn't spend the second book back in his world, tormented by memories of his own death. Not sure what it would mean for Roland to have both of them along from that point forward.
Asimov's worlds might suit him better, since they're more science-focused. I'm sure he'd feel more comfortable there, but at the same time, the stories I've read most are operating on a galactic scale. Conflicts between entire star systems, where the result is preordained because Hari Seldon mathematically deduced out what would happen years before. Would Spider-Man fit in the Foundation series?
I think there's something you could do with him. Have Peter end up on Terminus (where the First Foundation was established*), but without any idea where/when he is or how to get home. He manages to find some sort of work, maybe science-related, maybe, given his lck of suitable papers, a janitorial job at a science facility (since he figures that's his best shot to get home). He can have coworker hijinks, and because he's Peter Parker, he'll catch the eye of some unusually attractive woman, whose attention he'll try to deflect (I'm going with married Spider-Man). In the meantime, he keeps doing his Spider-Man thing, swinging around, saving people from accidents or random violence**. The citizens have never seen someone like Spider-Man before. Guy in a bright costume, not affiliated with a law enforcement or political entity, randomly saving people in trouble. Spidey's actions begin to affect the populace. More people take things into their own hands (for good or ill), or express disdain for authority figures (even on an alien world, in some new universe, Spider-Man would still mouth off at people who told him to stop doing whatever a spider can). Scientific inquiry is being diverted into augmenting humans, instead of advancing faster-than-light travel, or terraforming, or whatever.
It starts on Terminus, but word spreads to other systems through the Traders, and the stories are exaggerated, misconstrued, probably dismissed in some systems, while taken as cause for alarm in others. It's almost a given some planet would see Spider-Man's seemingly random acts of altruism as a smokescreen for what was a test of some new weapons' program the Foundation was starting. After all, it's easy to detect a fleet of ships with planet-devastating power heading towards your world. One seemingly innocuous spaceship, which just so happens to carry a super-being capable of destroying the world single-handedly, would be another matter. That Spider-Man hadn't demonstrated that level of power could be dismissed as part of the smokescreen, or with the idea he's a prototype or infiltration/espionage specialist. Rather than destroying the world, simply steal critical information or destabilize society. Things are getting stirred up. Terminus has diplomatic situations to deal with they aren't prepared for, especially since their government actually doesn't have anything to do with Spider-Man.
That's part of why I think he might work here, if we go with the idea of Spider-Man having a lot of the trickster in him. Admittedly, this is something JMS played around with, and that might be reason enough to want to avoid it. But I like the idea of throwing someone with that sort of bent into a society where people trust in this mathematical formula that tells them everything is gonna be OK. It knows when a particular problem will arise, tells them precisely how to deal with it, and they go along with it. This could take place before the Mule's arrival, or after, depending on how you want to play it*** . Throw in a guy who monkey wrenches all that, but, unlike the Mule, isn't doing it to conquer. In fact, nobody can figure out why he's doing it, except because he wants to help. But there are suspicions, and there are theories.
If we do this after the Mule, people in the First Foundation are going to suspect him of working for the Second Foundation. His actions may seem random, but they'll be perceived as part of some plan to guide events so things stay on the course the Plan has charted. Not only will Spider-Man be pursued by people who don't want to fear manipulation at the hands of psionics, the people he saves might also be at risk, as people will wonder what greater role they're going to play. Meanwhile, the Second Foundation doesn't know who the hell this spider guy is, but he's mucking things up. Those diplomatic issues I mentioned? They weren't supposed to arise at all. Which means things are off the plan, and that's unacceptable. So the Second Foundation sends their best agents after him. Then there are the people afraid of him simply because he has powers that differentiate him from everyone else, and after the Mule, folks are likely to be gunshy about that.
Meanwhile, overall confidence in the Seldon Plan is on the decline. One mutant who throws things off, is one thing, but two? What if it's the start of a wave of them? Seldon couldn't have predicted that, could he? The people concerned about Second Foundation interference are putting a lot of stock in the actions of individuals, given it's groups that are supposed to be predictable and able to affect large-scale changes. And the Second Foundation is confounded by the fact someone is disrupting the Plan, seemingly without even meaning to.
I don't know what the endgame for it all would be. I can't imagine Peter would be able to elude the Second Foundation forever, unless he plays the First Foundation's hunt for him against them. If they do catch him, the fact he remembers Earth could lead into the later books, if Peter thinks the key to his getting home lies there. Both Foundations might be glad to be rid of him. Or it could turn out that people reject the Plan, start trying to actively go against it, and the new Galactic Empire might fall apart before it even gets started. Which would trigger that 35,000 years of chaos Seldon was trying to avoid, so maybe that's too much chaos into the system.
* I'm not sure when in the series I'd be introducing him. Certain things work best with the situation in Foundation, others would work better with Second Foundation.
** I never had the impression the Foundation worlds were utopias, and certainly there were crimes in the Robot series books, since they were murder mysteries, although they take place thousands of years earlier.
*** Or simultaneously if you want Peter to struggle with how to stop a Xavier - or greater - level
telepath at the head of a space armada who probably won't come out of his space ship anywhere near Spider-Man, and could likely take over his mind if he did.