Let's say i made an app that notifies the user when a game on Steam became free for a limited time. Some other person or company makes an app that notifies the user when there's a specific item on Steam market is being sold for less than a dollar. I don't know the company/person and he/she/they don't know me. We use similar looking codes in our own apps but his/her/theirs has a license, mine doesn't. I use his/her/their code without knowing that it's under license and it belongs to them. Can i get sued for this?
Your factual claims are a bit unclear, specifically where you say that you don't know them but you use their code. I take it you mean that you are not personally acquainted with the other party, but you did somehow acquire his code, and then you used it in your own work.
This is copyright infringement, and you can easily get sued. Anytime you copy someone else's code without their permission, you have infringed their copyright. It is not a defense that you didn't know they you're required to have permission, and it is not a defense that you changed the code (since copyright is about copying, not verbatim copying). It would be particularly difficult to maintain that you didn't know that permission is required since you say that their code has a license. (If your code has no license, that means nobody other than yourself can legally use it).
On the off chance that you did not actually mean to say that you used their code, and you meant to say that you accidentally or coincidentally wrote similar-looking code, then the legal question is more complicated (essentially unanswerable in a useful way, at least here). One way to establish violation of copyright law is to prove actual copying (eyewitness accounts, confessions, etc.). Alternatively, the fact-finders (jury or judge) would have to look at the degree of similarity between the works, to determine whether the similarity is so great that it could not be coincidence or functionally necessary. For example, all examples of bubble sort have a certain necessary similarity. All music with a certain genre is somewhat similar, given the nature of the genre. You would then need to hire an attorney (one experienced in software copyright and substantial similarity doctrines) to assess the particular facts. The point is that even if you did not in fact copy, you could be found guilty of having copied based on such similarity.