In a studio you would typically record a guitar through an amp in a space that was basically soundproofed. In a bedroom or home studio however you’re unlikely to have that luxury. All kinds of environmental sounds could seep into the recording, especially if your playing is on the quieter side. On the other hand, you might struggle to turn it up loud for fear of annoying the neighbours. Both of these scenarios can be greatly improved by creating a shield around the mic that’s pointing at your guitar amp, essentially boxing it in and containing sound within while shielding sound from without. Sofa cushions are ideal for this, or a heavy duvet - being careful that it doesn’t drag the mic stand down due to its weight. The only real limitation is that you want soft or softened surfaces - hard surfaces like wooden panels will just reflect sound internally too much.
This is another isolation technique. Heavy electric guitar and also electric bass can cause an amp to lose a lot of energy by transmitting it into the floor. In the same way that studio monitors can be tightened up by placing them on stands or mounts, a guitar amp placed on a crate or two should sound noticeably tighter, especially with bassier tones. Special stands do exist, but they cost money.
If you already have guitar pedals, that’s great of course. But if it comes down to spending several hundred on hardware and that’s beyond your budget, consider using free or inexpensive plug-ins to replicate those effects. There are some tradeoffs - using plugs during recording can introduce latency so an interface or desk with direct monitoring will help you. On the other hand it does mean you can record direct in without the need for an amp, which if you happen not to have one, is another cost saving. Software effects can also be tweaked or replaced afterwards which isn’t possible if the tone is coming from a hardware amp and pedals.
Obviously a nice condenser or ribbon mic run through a great preamp is the ideal way to capture the nuanced sound of an acoustic guitar, but it comes at a price. While I wouldn’t necessarily suggest using a phone by itself except in an emergency, a small handheld digital stereo recorder like those from Zoom or Yamaha with small condenser mics can be a good way to go, and are cheaper than a full-blown recording setup. How this fits into your wider songwriting system will depend on what you’re doing, but you could record your part while following a click track in earphones, and transfer the resulting file into your DAW.
Studios will use specific mics to record guitars, the Shure SM57 or Sennheiser MD421 being examples of very popular mics for this task. But if you are on a strict budget and need to record other things as well like vocals or percussion, go for a good all-round mic rather than one that’s specifically suited to one type of source. You might have to adapt your recording technique a little between sources with regard to positioning, but it will save money.