Old, cheap or poor quality interconnects can easily introduce unwanted noise into a signal. Buzz, hiss and crackle are especially risky with guitar or bass recordings, where the player will move around a little as they play. You don't have to spend a fortune on cables - you may not even need all that many of them. But make sure they are decent and well maintained, to prevent problems.
With every extra stage a sound passes through, the risk of noise or interference increases. A mic connected to a mixer or audio interface is about as simple as it gets. A guitar running through several stomp boxes has a greater risk of noise. If you're not using any particular piece of gear it's best to remove it from the chain altogether - not just bypassing it with a button but physically disconnecting it. The same doesn't apply to software effects, which don't tend to create noise in the same way that physical hardware can do.
You may have heard much talk by engineers about the quality of their preamps and wondered what the big deal was. The better quality the preamp that connects your mics to your digital system via an audio interface or mixer, the lower the chance of noise and the better quality the signal will be. Good preamps provide a smooth, solid signal which is easy to record and work with. Here's a video from Joe Albano explaining more about this - in fact there's a whole course about the fundamentals of mixing and mastering that you can check out here: https://ask.audio/academy?nleloc=course/2708/mixing-and-mastering
Each part of a recording chain - or most parts at least - have volume or gain controls. This means that gain discrepancies can occur if you're not paying attention to the level settings at the various different stages the signal goes through. Let's say your guitar is only set to 50% volume, and you're pushing your audio interface level higher to get the signal loud enough. Or your mic input is quite low, and you're using heavy compressors and high fader levels in your DAW's mixer to get the levels up. Both of these are poor choices and will introduce unnecessary noise into the recording.
Start at the beginning of the chain and make sure all levels are healthy without being too low or high, so you're not compensating for sound that's too quiet or loud. Send a solid signal (75-90% of full volume) from the source and you'll find your subsequent levels can be set normally because the signal they're receiving is at about the right level.
Gating a mic is pretty much a requirement for most recording tasks where a single source is to be captured, as opposed to a drum kit for example, where it's impractical because of the bleed between different mics. But for a vocal, bass, guitar or other single mic source, applying a gate with the correct attack, threshold and release settings will ensure that when there's no singing or playing, no signal will pass through and so no background noise will be recorded. Make sure not to gate too aggressively, or you'll get artificial sounding cut-offs as the gate snaps open and closed.
Watch the comprehensive course AudioPedia 108: Mixing And Mastering and learn everything you need to know about these production techniques: https://ask.audio/academy?nleloc=course/2708/mixing-and-mastering