Both statements involve negation but foreground different elements. In «lā fīhā ghawl», the location precedes the negated noun and is prominent in a contrast. In «lā rayba fīhi», the absence of doubt is announced first and the reference is attached afterward.
ExpressionOrderRhetorical focus
Lā fīhā ghawlNegation + locative + nounDistinguishing the referenced place/thing
Lā rayba fīhiNegation + noun + complementDenial of doubt and its reference
Context and the precise negating construction both contribute to the final interpretation.