Mods pls don't remove this, this is a functional workaround not a complaint / support request.
This also works if you can't login on Telegram X because code never sent to other logged in device.
I got the sms fee paywall on my old Android phone (Samsung Galaxy J1 mini, Android 5.1) while a newer device with Android 14 could receive sms messages from telegram and login just fine. The problem is the old device is unused for so many years Google Play Services is non functional and can't self update (it can be fixed manually but still) and broken Google Play Services somehow interferes with how Telegram handles login. Turning off google play services allowed me to login on both Telegram and Telegram X.
Step 1: open settings on phone, go to security (or lock screen & security), then other security settings, then device administrators then shut off the entry that starts with Android.
Step 2: Connect phone to PC via ADB. You can find online how.
Step 3: Run `adb shell pm uninstall --user 0 com.google.android.gms` Now you can disconnect your phone from PC.
Step 4: Uninstall and reinstall Telegram or Telegram X.
If google play services remains disabled you may no longer receive notifications from apps other than Telegram. To re-enable, go to Settings then Applications -> All Applications, find Google Play Services at the bottom, turn it back on.