She heard a dog barking off in the distance.

Literal

She [topic-は] distance [at-で] dog [subject-が] is-barking [nominalizer-の] [object-を] heard (lit. ear-did).

Watch the で / に contrast: this sentence uses 遠くで because the action of barking is happening at that location — で marks where actions take place, while に would mark where something simply is. The clause 犬が吠えている ('a dog is barking') is then nominalized by の and taken as the object of 耳にする, 'to catch wind of' or 'to hear.' 耳にする is a body-part idiom (ear-do) common in slightly formal speech and writing for indirect or incidental hearing — neighbors gossiping, news passing through. The plainer alternative would be 聞く ('to hear / listen').