Many words that we use as prepositions can also be used as adverbs. A number of them are also conjunctions and adjectives. To recognize the difference in using them, we need to remember that there is a noun or pronoun after the preposition. The noun or pronoun is the object of the preposition. An adverb does not take an object.
- A small stream flows across the plain. (Preposition)
- This river has no bridge, we have to swim across. (Adverb)
In the first sentence above, we have the noun plain coming after the word across (across the plain). The noun plain is the object of the preposition across. The second sentence has the verb swim which doesn't have an object. The word across that comes after the verb is easily recognized as an adverb as it doesn't take an object and it also modifies the verb swim.
- The railway runs alongside the highway. (Preposition)
- We wondered what the driver wanted when his car came alongside. (Adverb)
- Who is that person between you and your brother on the photo? (Preposition)
- This is a photo of that famous footballer's legs with a football between. (Adverb)
- There are too many prisoners in the prison. (Preposition)
- Who says you can just come in? (Adverb)
- This is the second time he's fallen off his horse. (Preposition)
- All of us were at the airport to see her off. (Adverb)
- Your puppy is sleeping underneath my car. (Preposition)
- His left eye was swollen with a bruise underneath. (Adverb)
For more such words, see List 11 - Prepositions for words used as prepositions or as adverbs.