It depends on the the sentence.
1. There's a river nearby. (nearby = adverb of place)
2. There's a nearby river. (nearby = adjective)
#1 is more colloquial. (Nothing to do with formality)
Similar adverbs to nearby: there, here, over there,...
The river over there. The river over here. The river nearby.