A second phone number keeps your main number private. If you only need it to receive a code, there are free options. Here is how they compare.
Free, instant and no install. You read the code in your browser. Best for one-time verification. Not suited to accounts you keep.
Some apps give you a number inside the app. Many are free at first and then charge monthly, and they often work only in one or two countries.
The most reliable option, but you pay for the SIM and credit, and you need a spare phone or a dual-SIM phone.
A middle path: not free, but low cost, with numbers from many countries. You pay per SMS received or per day.
For a single code, use a temporary phone number. For a second number you will use again, rent a private one.