How do i determine if the prepositional phrase is an adverb or adjective?

Adjectives tell which, what kind of, or how many about nouns or pronouns.

Adverbs tell where, when, and to what extent about a verbs, adjectives, and other adverbs.

Usually the word just before a prepositional phrase is the word that is modified.