I mean, is a guitar designed for a specific string type?
Nylon guitars typically have less sturdy bracing. They might not hold up to steel strings.
Steel guitars can be switched to nylon. You’d probably need the set up adjusted. That’s routine maintenance.
It really depends on the cost of the guitar. I’d put steel strings on an inexpensive nylon guitar.
Keep it tuned down a half step. That reduces the string tension. The guitar would probably be fine for several years. Maybe longer.
I assume that the OP is specifically referring to acoustic guitars.
Nylon strings wouldn’t work on a standard electric guitar (with magnetic pickups), as the pickups produce a signal (which gets translated to sound) when you strum the steel strings, which then distort the magnetic field created by the pickups.
I had a Martin D18 acoustic I ran nylons on for a while. It was a neat sound. The D18 is set up for steel strings like said above, the tension is less on nylons so it’s okay to run those on a steel setup. Not sure you would want to go the other way.
My guitar instructor said that he ruined one of his guitars when he was just starting out: put steel strings on a classical guitar. The tension bent the neck of the guitar.
Running steel strings on a nylon string guitar is no bueno. I trashed my first acoustic guitar (technically my Dad’s 3rd anniversary gift from my Mom that he handed down to me. A western Silvertone from Sears) exactly in this way. You can put nylon strings on a steel string guitar and it won’t have any deleterious effects other than having to adjust the set-up and the fact a magnetic pick up won’t work.