Previously I heard connection between this two types of materials may cause corrosion And because of that we have to use some nonmetallic part between if needed. It wasn’t right?
Connecting dissimilar metals can result in galvanic corrosion issues, but you have join them somehow. You need to evaluate the risks.
This is common even in corrosion sensitive environments, however these welds need to to be protected.
Proper selection of filler metal is necessary for dissimilar metal welds in certain applications. Good engineering practice reduces the need for DMW's in service.
I would avoid any dissimilar metal welds in a corrosive service where the less corrosion resistant material (carbon steel in this case) is already a marginal selection. If it is a noncorrosive service and the only corrosion you're worried about is external, it's not a big problem.
As far as the mechanical integrity of such welds, if the weld procedure and filler metal are selected properly and all the other requirements of ASME IX as well as any additional local requirements you may have, you are good to go..