While a bit broad I think the meat of your question is answerable.
Whether renting part of a house or an entire house is lucrative depends primarily on the local market and the quality of tenants available to you. To increase chances of success you want to not be utterly dependent on the rental income, which means healthy cash reserves to pay for various repairs or covering periods of vacancy. If you can comfortably afford the house without renting a portion of it, then you can view any rental income as just getting you ahead. That is a better situation than over-extending with the idea that you'll have consistent rental income.
Being a landlord at a distance is typically more costly, you'd typically need a property management company to deal with it, which is commonly 7-10% of your rental income. So it is even more important to not be overly dependent on the rental income and to be confident in the long-term growth/profitability of the area.
Debt to income ratio is a key factor for mortgage approval, so if you plan to move in 5 years and want to buy another house in a different state you'll need sufficient income to satisfy the debt to income requirements of lenders. They will only count a portion of your rental income. If you were only renting out a portion of the house before moving, the rental income would be much lower than after you started renting out the entire house. It will take significant income to qualify for a mortgage on a new property right away after moving, so if that's your goal I would buy something well below the max you qualify for.
If you feel confident that your area is a good rental market and that prices will continue to move upward then it could be very lucrative, but there are no guarantees and some unfortunate tenants or costly home repairs can sink some people if they aren't financially prepared. Personally, I maintain an emergency fund that provides 8 months of expenses that is based on all my expenses (all rentals and my primary residence) and zero income (every tenant stops paying rent, no job income, etc).