Dialogue
Technical stuff first.
This is right: I said, "You're beautiful."
This is also right: I smiled shyly. "Thank you."
The first sentence is because the dialogue is part of the sentence so needs a comma. The second is right because the smiling part is a sentence all on its own. This is also true the other way around.
This is right: "You're beautiful," I said.
This is also right: "Thank you." I smiled shyly.
Even if it is a question, you treat it as part of the sentence.
This is right: "Are you crazy?" she muttered.
But if the part afterward isn't part of the sentence, don't do a lower case.
This is right: "Are you crazy?" I pushed past her.
If you want something more detailed try this site. I think JK Rowling is an amazing author though I really struggle to read her books more than once. Because she goes with the adage that a good story trumps everything. If you want more on that check out this site. But the reason I bring her up is she made the mistake of trying to use too many dialogue tags. That is where we get the unfortunate line of Ron ejaculating on the page. There is nothing wrong with just plain old said.
How to make it natural
I struggle with this. I blame my mother she has a large vocabulary and when I write dialogue I tend to write that vocab instead of what people really sound like. So I will lean on those that are better than me.
The last bit is to avoid the chit chat. Ever wonder why movies never have people saying goodbye on the phone. It is to speed up the narrative. The same is true for books.
Your homework is to write a scene only with dialogue. If you want to go expert level see if you can have several people all talking in the same conversation. But if you can write it without tags and people still know who is speaking you have been successful.