The general rule is that any is used for questions and negatives while some is used for positive.
Both may be used with countable and uncountable nouns.
Do we need any rice?
No, we don’t need any rice.
We have some rice in the cupboard.
Some may also be used for questions, typically offers and requests, if we think the answer will be positive.
Would you like some wine?
May I have some more chocolate?