The best way is cultural immersion - whether through conversations with real people online or ideally in the location. Duolingo and the like are great for building vocab - similar to what you said about understanding rules, etc., but really it comes down to how people use it in real life scenarios
learning languages

i don't exactly like duolingo, its not as challenging as i need, and i often forget whenever i use it
however, i don't know many other language learning apps besides like, babbel
especially because they've gotten rid of/are getting rid of so many features
though, it can help with the cultural immersion part, as the events section creates alot of opportunities to speak with native speakers, and other learners
what is your personal method of learning languages? asking because im curious, and looking for some ideas, as my method doesn't work the best for me, and im not sure what to do
i try to interact with media in said language (stories, podcasts, music, etc.), and, as of learning the language itself, i usually write down the words and different rules it has, and try my best to use it whenever i speak to people/myself