Two local authorities have joined forces in a bid to protect residents and coastal communities from flooding and erosion.