I do know the question in the title is really stupid, but it is the best phrasing I could come up with. Let's say I am building a circuit and the schematic says to use a BD139 transistor. Would there be any issue in using any other NPN transistor? What would I do if I could not find this transistor? I can't buy any parts online, and I do not have access to a store where they would sell this stuff, so I am limited to what I can salvage from old broken electronics, most of which have older, outdated parts that have limited information online.
Would there be any issue in using any other NPN transistor?
If you are missng a screw, can you add any screw ?
Would it depend on how long is the screw ? What is its thread is? How large is the diameter ? What is the material ?
Similarily, all electrical components have electrical characteristics and parameters. Different components can tolerate more voltages and currents than others. Others are set up for a particular application even though they are all part of the same family of components (capacitors, resistors, inductors, transistors, diodes).
So yes transistors are interchangeable, if the type (npn/pnp) and required specs match.
What would I do if I could not find this transistor?
You compare the parameters for the transistor you can have access too, and compare it to the one in the you want to have. You keep searching until you can find one that can handle it. Now, someone might have used an a transistor that was overkill for the project, and so knowing a bit about the circuit would help. If the current through a transistor was only 10mA and they have a part that can tolerate 1A, well, that's a bit much, and you can find a part that is more suited to what the circuit it. But if you do not have knowledge with how to analyse circuits, then you should probably match the component (to be on the safe side).