In other words if two residues have sequence numbers, say, 20 and 21 then are they next to each other in the backbone? If no (or not necessarily) then is there any way to find consecutive residues from a PDB file?
The residue numbering convention in the PDB is more-or-less entirely up to the depositor of the structure. While generally speaking sequential numbers are next to each other, there is no guarantee of that fact.
For example, the PDB allows for what are called "insertion codes", which are extra residues which interrupt the regular sequence progression. For example in the PDB entry 1IGY in between residues 52 and 53 on chain B is residue "52A". Normally, these insertion codes are used because the depositors want the numbering scheme to correspond with some external numbering standard, and there are extra residues (e.g. from affinity maturation) which would throw off this numbering.
Alternatively, the depositor might choose to mix up the numbering significantly. An example of this is the PDB entry 4OO9, which is the transmembrane domain of human mGlu5 with a lysozyme insertion to help crystallization. The mGlu5 is numbered from chain A from 568 to 832, but between residues 678 and 680 are residues 1002 to 1162, representing the inserted lysozyme. (So it goes 677, 678, 1002, ...)
Ultimately, the only reliable way to tell if two residues in the PDB which are sequential in numbering are actually sequential polymerically is to actually look at the coordinates and see if they're in a bonding configuration. There may be some information about "out-of-order" residue numbering in the header lines, but that's not always clear. Usually you have to deal with such situations on a case-by-case basis.